intercom 3.5.15 → 3.5.16
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.
- checksums.yaml +4 -4
 - data/changes.txt +3 -0
 - data/lib/intercom/traits/api_resource.rb +5 -5
 - data/lib/intercom/version.rb +1 -1
 - data/spec/unit/intercom/traits/api_resource_spec.rb +34 -3
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 7941aa95bd27e3f1807f11593a33ea7d4717107d
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 3bafd3ab40b8eba3f62faecbcd6262cf335da705
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: a84a61e028ae77913bf19bd336134e31aad994d33258bd2c0e8d46f9b2b1ea09c652e312471366a7cb6b266a5570c6adcf271dcbf00ee8a9ebaa7cf613765c8f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 12d83ef9c8632511ac319760252525f6803b2865d5bdd450029af47f4df61e9f329f5bb46dd1caec7175435988d85ef4ab195ec6840c22a9b1d6bc06d481adcb
         
     | 
    
        data/changes.txt
    CHANGED
    
    
| 
         @@ -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
         
     | 
    
        data/lib/intercom/version.rb
    CHANGED
    
    
| 
         @@ -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  
     | 
| 
      
 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. 
     | 
| 
      
 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- 
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2017-06-12 00:00:00.000000000 Z
         
     | 
| 
       19 
19 
     | 
    
         
             
            dependencies:
         
     | 
| 
       20 
20 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       21 
21 
     | 
    
         
             
              name: minitest
         
     |