intercom 3.5.15 → 3.5.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8736fc189f694a87cf8fa4d9a5196d8dccb7244d
4
- data.tar.gz: 35c553782dc058139212ce9f5fcad13cf722e000
3
+ metadata.gz: 7941aa95bd27e3f1807f11593a33ea7d4717107d
4
+ data.tar.gz: 3bafd3ab40b8eba3f62faecbcd6262cf335da705
5
5
  SHA512:
6
- metadata.gz: ba36260e11e2dda2c3b6f4a44e683e3d442e85923b35ffcca0a9adbb8870b23bd5cf2640cf1c4704bb36c633946b3ff9252054fe6973ba203fb665b30518a4c3
7
- data.tar.gz: 8027f84fd08f6c0aaa992e111172892e3700bada6e2adaf0e314bf422f07ac4d5e3defe8fe8ce49230460c95d1b97be96f2113677b2a64644b2f0b573881a8ce
6
+ metadata.gz: a84a61e028ae77913bf19bd336134e31aad994d33258bd2c0e8d46f9b2b1ea09c652e312471366a7cb6b266a5570c6adcf271dcbf00ee8a9ebaa7cf613765c8f
7
+ data.tar.gz: 12d83ef9c8632511ac319760252525f6803b2865d5bdd450029af47f4df61e9f329f5bb46dd1caec7175435988d85ef4ab195ec6840c22a9b1d6bc06d481adcb
@@ -1,3 +1,6 @@
1
+ 3.5.16
2
+ - Standardize comparison of attribute as string when input is Hash or JSON
3
+
1
4
  3.5.15
2
5
  - UnauthorizedError on invalid token
3
6
  - BlockerUserError on restoring blocked user
@@ -78,13 +78,13 @@ module Intercom
78
78
  end
79
79
 
80
80
  def custom_attribute_field?(attribute)
81
- attribute == 'custom_attributes'
81
+ attribute.to_s == 'custom_attributes'
82
82
  end
83
-
83
+
84
84
  def message_from_field?(attribute, value)
85
85
  attribute.to_s == 'from' && value.is_a?(Hash) && value['type']
86
86
  end
87
-
87
+
88
88
  def message_to_field?(attribute, value)
89
89
  attribute.to_s == 'to' && value.is_a?(Hash) && value['type']
90
90
  end
@@ -94,7 +94,7 @@ module Intercom
94
94
  !custom_attribute_field?(attribute) &&
95
95
  !message_from_field?(attribute, value) &&
96
96
  !message_to_field?(attribute, value) &&
97
- attribute != 'metadata'
97
+ attribute.to_s != 'metadata'
98
98
  end
99
99
 
100
100
  def typed_value?(value)
@@ -107,7 +107,7 @@ module Intercom
107
107
  end
108
108
 
109
109
  def type_field?(attribute)
110
- attribute == 'type'
110
+ attribute.to_s == 'type'
111
111
  end
112
112
 
113
113
  def initialize_missing_flat_store_attributes
@@ -1,3 +1,3 @@
1
1
  module Intercom #:nodoc:
2
- VERSION = "3.5.15"
2
+ VERSION = "3.5.16"
3
3
  end
@@ -17,6 +17,26 @@ describe Intercom::Traits::ApiResource do
17
17
  "color"=>"cyan"
18
18
  }}
19
19
  end
20
+
21
+ let(:object_hash) do
22
+ {
23
+ type: "company",
24
+ id: "aaaaaaaaaaaaaaaaaaaaaaaa",
25
+ app_id: "some-app-id",
26
+ name: "SuperSuite",
27
+ plan_id: 1,
28
+ remote_company_id: "8",
29
+ remote_created_at: 103201,
30
+ created_at: 1374056196,
31
+ user_count: 1,
32
+ custom_attributes: { type: "ping" },
33
+ metadata: {
34
+ type: "user",
35
+ color: "cyan"
36
+ }
37
+ }
38
+ end
39
+
20
40
  let(:api_resource) { DummyClass.new.extend(Intercom::Traits::ApiResource)}
21
41
 
22
42
  before(:each) { api_resource.from_response(object_json) }
@@ -76,18 +96,29 @@ describe Intercom::Traits::ApiResource do
76
96
  proc { api_resource.send(:flubber=, 'a', 'b') }.must_raise NoMethodError
77
97
  end
78
98
 
79
- it "an initialized ApiResource is equal to on generated from a response" do
99
+ it "an initialized ApiResource is equal to one generated from a response" do
80
100
  class ConcreteApiResource; include Intercom::Traits::ApiResource; end
81
101
  initialized_api_resource = ConcreteApiResource.new(object_json)
82
102
  except(object_json, 'type').keys.each do |attribute|
83
103
  assert_equal initialized_api_resource.send(attribute), api_resource.send(attribute)
84
104
  end
85
105
  end
86
-
106
+
107
+ it "initialized ApiResource using hash is equal to one generated from response" do
108
+ class ConcreteApiResource; include Intercom::Traits::ApiResource; end
109
+
110
+ api_resource.from_hash(object_hash)
111
+ initialized_api_resource = ConcreteApiResource.new(object_hash)
112
+
113
+ except(object_json, 'type').keys.each do |attribute|
114
+ assert_equal initialized_api_resource.send(attribute), api_resource.send(attribute)
115
+ end
116
+ end
117
+
87
118
  def except(h, *keys)
88
119
  keys.each { |key| h.delete(key) }
89
120
  h
90
121
  end
91
-
122
+
92
123
  class DummyClass; end
93
124
  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: 3.5.15
4
+ version: 3.5.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben McRedmond
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2017-06-07 00:00:00.000000000 Z
18
+ date: 2017-06-12 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: minitest