Skip to content

Commit

Permalink
Merge pull request #128 from intercom/jo/add-update-last-request-at
Browse files Browse the repository at this point in the history
add update_last_request_at
  • Loading branch information
josler committed Oct 28, 2014
2 parents 62a7ec5 + 3be29fd commit 7ece071
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/intercom/lib/dynamic_accessors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class << self

def define_accessors(attribute, value, object)
klass = object.class
if attribute.to_s.end_with? '_at'
if attribute.to_s.end_with?('_at') && attribute.to_s != 'update_last_request_at'
define_date_based_accessors(attribute, value, klass)
elsif object.flat_store_attribute?(attribute)
define_flat_store_based_accessors(attribute, value, klass)
Expand Down
5 changes: 5 additions & 0 deletions spec/unit/intercom/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@
user.unsubscribed_from_emails.must_equal true
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"
end

it 'allows update_last_request_at' do
Intercom.expects(:post).with("/users", {"user_id" => "1224242", 'update_last_request_at' => true, "custom_attributes" => {}}).returns({"user_id" => "i-1224242", "last_request_at" => 1414509439})
Intercom::User.create(user_id:'1224242', update_last_request_at:true)
end

it "allows easy setting of custom data" do
now = Time.now
Expand Down

0 comments on commit 7ece071

Please sign in to comment.