Skip to content

Commit 7ece071

Browse files
committed
Merge pull request #128 from intercom/jo/add-update-last-request-at
add update_last_request_at
2 parents 62a7ec5 + 3be29fd commit 7ece071

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/intercom/lib/dynamic_accessors.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class << self
66

77
def define_accessors(attribute, value, object)
88
klass = object.class
9-
if attribute.to_s.end_with? '_at'
9+
if attribute.to_s.end_with?('_at') && attribute.to_s != 'update_last_request_at'
1010
define_date_based_accessors(attribute, value, klass)
1111
elsif object.flat_store_attribute?(attribute)
1212
define_flat_store_based_accessors(attribute, value, klass)

spec/unit/intercom/user_spec.rb

+5
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@
7777
user.unsubscribed_from_emails.must_equal true
7878
user.user_agent_data.must_equal "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11"
7979
end
80+
81+
it 'allows update_last_request_at' do
82+
Intercom.expects(:post).with("/users", {"user_id" => "1224242", 'update_last_request_at' => true, "custom_attributes" => {}}).returns({"user_id" => "i-1224242", "last_request_at" => 1414509439})
83+
Intercom::User.create(user_id:'1224242', update_last_request_at:true)
84+
end
8085

8186
it "allows easy setting of custom data" do
8287
now = Time.now

0 commit comments

Comments
 (0)