intercom 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/changes.txt CHANGED
@@ -1,3 +1,6 @@
1
+ 0.1.5
2
+ - Always convert times to unix timestamps for the wire (thanks @jgwhite)
3
+
1
4
  0.1.4
2
5
  - Intercom::User.all now includes Enumerable
3
6
 
@@ -63,6 +63,7 @@ module Intercom
63
63
  return object.for_wire if object.respond_to?(:for_wire)
64
64
  return object.map { |item| for_wire(item) } if object.is_a?(Array)
65
65
  return object.inject({}) { |result, (k, value)| result[k] = for_wire(value); result } if object.is_a?(Hash)
66
+ return object.to_i if object.is_a?(Time)
66
67
  object
67
68
  end
68
69
 
@@ -81,4 +82,4 @@ module Intercom
81
82
  raise ArgumentError.new("Missing required parameters (#{missing.join(', ')}).") unless missing.empty?
82
83
  end
83
84
  end
84
- end
85
+ end
@@ -1,3 +1,3 @@
1
1
  module Intercom #:nodoc:
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -68,9 +68,9 @@ describe "Intercom::User" do
68
68
  now = Time.now
69
69
  user = Intercom::User.new()
70
70
  user.custom_data["mad"] = 123
71
- user.custom_data["other"] = now
71
+ user.custom_data["other"] = now.to_i
72
72
  user.custom_data["thing"] = "yay"
73
- user.to_hash["custom_data"].must_equal "mad" => 123, "other" => now, "thing" => "yay"
73
+ user.to_hash["custom_data"].must_equal "mad" => 123, "other" => now.to_i, "thing" => "yay"
74
74
  end
75
75
 
76
76
  it "allows easy setting of company data" do
@@ -198,4 +198,20 @@ describe "Intercom::User" do
198
198
  Intercom::User.expects(:find).with(:user_id => "abc123")
199
199
  Intercom::User.find_by_user_id("abc123")
200
200
  end
201
+
202
+ it "converts company created_at values to unix timestamps" do
203
+ time = Time.now
204
+
205
+ user = Intercom::User.new("companies" => [
206
+ { "created_at" => time },
207
+ { "created_at" => time.to_i }
208
+ ])
209
+
210
+ as_hash = user.to_hash
211
+ first_company_as_hash = as_hash["companies"][0]
212
+ second_company_as_hash = as_hash["companies"][1]
213
+
214
+ first_company_as_hash["created_at"].must_equal time.to_i
215
+ second_company_as_hash["created_at"].must_equal time.to_i
216
+ end
201
217
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intercom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2013-03-04 00:00:00.000000000 Z
16
+ date: 2013-03-15 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: minitest