intercom 2.1.3 → 2.1.4

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: 6976bd2a07095bf95783f7be2c63e77831c7ec9d
4
- data.tar.gz: 54f2e7cd0cb0b33c8499daece9f1a113ea322ea7
3
+ metadata.gz: d926e07d26eefd26f84f84ee9396712647c22782
4
+ data.tar.gz: 1fcca290fa346ceb3490400a8aa1295e2bc89e93
5
5
  SHA512:
6
- metadata.gz: 7bf7d2d7b646065cf719d56cf5df4f9503b549e466330d2013580333c3ac5ae55456c1587b2f98e55a432436b5a0b3dfb5a20adae248137db37614bd209f021b
7
- data.tar.gz: df456322206c0889a328fb0308421302b3606617cfcbe4219eb13fe6f4a731eecdabc74a1c68194c940c1bf8398ae4321a8541e3684d434ad70f72e85fd77517
6
+ metadata.gz: c9794f7becf939adab0d9d7c6c2c704494404a7b1af068cb15c5a450a50c0c6230dd28ff01ffd24157ac89dacaa4140d1bf0135c9df8bc800101c1c9f9ea73bb
7
+ data.tar.gz: af350c1a8b995fcea209a9e9c52eefd2753700664f8fc8b800e5c2539bf0a4870b2484b7c89cdb1bb6e1b175bf5d1d53f5943f77adab5800b18ab52a8ce7852d
data/changes.txt CHANGED
@@ -1,3 +1,6 @@
1
+ 2.1.4
2
+ - Rework hash helper extensions
3
+
1
4
  2.1.2
2
5
  - Clean up some spec warnings
3
6
  - Fix incrementing of custom data
@@ -0,0 +1,12 @@
1
+ class SliceableHash
2
+
3
+ def initialize(hash)
4
+ @hash = hash
5
+ end
6
+
7
+ # Return a hash that includes only the given keys.
8
+ def slice(*keys)
9
+ keys.map! { |key| @hash.convert_key(key) } if @hash.respond_to?(:convert_key, true)
10
+ keys.each_with_object(@hash.class.new) { |k, hash| hash[k] = @hash[k] if @hash.has_key?(k) }
11
+ end
12
+ end
@@ -37,7 +37,7 @@ module Intercom
37
37
  end
38
38
 
39
39
  def identity_hash
40
- respond_to?(:identity_vars) ? to_hash.slice(*(identity_vars.map(&:to_s))) : {}
40
+ respond_to?(:identity_vars) ? SliceableHash.new(to_hash).slice(*(identity_vars.map(&:to_s))) : {}
41
41
  end
42
42
  end
43
43
  end
@@ -1,5 +1,5 @@
1
1
  require "intercom/utils"
2
- require "ext/hash"
2
+ require "ext/sliceable_hash"
3
3
 
4
4
  module Intercom
5
5
  class CollectionProxy
@@ -1,3 +1,3 @@
1
1
  module Intercom #:nodoc:
2
- VERSION = "2.1.3"
2
+ VERSION = "2.1.4"
3
3
  end
@@ -71,8 +71,13 @@ describe Intercom::Traits::ApiResource do
71
71
  it "an initialized ApiResource is equal to on generated from a response" do
72
72
  class ConcreteApiResource; include Intercom::Traits::ApiResource; end
73
73
  initialized_api_resource = ConcreteApiResource.new(object_json)
74
- object_json.except('type').keys.each do |attribute|
74
+ except(object_json, 'type').keys.each do |attribute|
75
75
  assert_equal initialized_api_resource.send(attribute), api_resource.send(attribute)
76
76
  end
77
77
  end
78
+
79
+ def except(h, *keys)
80
+ keys.each { |key| h.delete(key) }
81
+ h
82
+ end
78
83
  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: 2.1.3
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben McRedmond
@@ -15,76 +15,76 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2014-07-28 00:00:00.000000000 Z
18
+ date: 2014-08-07 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: minitest
22
22
  requirement: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  type: :development
28
28
  prerelease: false
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: rake
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  type: :development
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: mocha
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: fakeweb
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.3'
69
69
  type: :development
70
70
  prerelease: false
71
71
  version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.3'
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: json
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  type: :runtime
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  description: 'Intercom (https://www.intercom.io) is a customer relationship management
@@ -103,8 +103,8 @@ executables: []
103
103
  extensions: []
104
104
  extra_rdoc_files: []
105
105
  files:
106
- - .gitignore
107
- - .travis.yml
106
+ - ".gitignore"
107
+ - ".travis.yml"
108
108
  - Gemfile
109
109
  - MIT-LICENSE
110
110
  - README.md
@@ -112,7 +112,7 @@ files:
112
112
  - changes.txt
113
113
  - intercom.gemspec
114
114
  - lib/data/cacert.pem
115
- - lib/ext/hash.rb
115
+ - lib/ext/sliceable_hash.rb
116
116
  - lib/intercom.rb
117
117
  - lib/intercom/admin.rb
118
118
  - lib/intercom/api_operations/count.rb
@@ -171,12 +171,12 @@ require_paths:
171
171
  - lib
172
172
  required_ruby_version: !ruby/object:Gem::Requirement
173
173
  requirements:
174
- - - ~>
174
+ - - "~>"
175
175
  - !ruby/object:Gem::Version
176
176
  version: '2.0'
177
177
  required_rubygems_version: !ruby/object:Gem::Requirement
178
178
  requirements:
179
- - - '>='
179
+ - - ">="
180
180
  - !ruby/object:Gem::Version
181
181
  version: '0'
182
182
  requirements: []
data/lib/ext/hash.rb DELETED
@@ -1,18 +0,0 @@
1
- class Hash
2
- # Return a hash that includes everything but the given keys.
3
- def except(*keys)
4
- dup.except!(*keys)
5
- end
6
-
7
- # Replaces the hash without the given keys.
8
- def except!(*keys)
9
- keys.each { |key| delete(key) }
10
- self
11
- end
12
-
13
- # Return a hash that includes only the given keys.
14
- def slice(*keys)
15
- keys.map! { |key| convert_key(key) } if respond_to?(:convert_key, true)
16
- keys.each_with_object(self.class.new) { |k, hash| hash[k] = self[k] if has_key?(k) }
17
- end
18
- end