incontact_client 0.0.1 → 0.0.2

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: 84377ebde8c6ffb71a41543c5513db5e8346f51e
4
- data.tar.gz: 8fcf308b9495afd2f56653092c2443ea08c9a824
3
+ metadata.gz: fb59794b41314cf29ea18eb41052cb81bfc695a9
4
+ data.tar.gz: 42420a91b298e08ddab7cc9368e69115f547ff04
5
5
  SHA512:
6
- metadata.gz: d5b2a65caabd1618354f7f5bef28b1eeb5a2ed97b21cd9ba3ae4d7d4e38fb99dd50669643ce6088e2858b29da9cf0c55ff7261c1e02c46483822ecd76b04e094
7
- data.tar.gz: 699f0e7f1bac9c21677bcc03587cd9fb11450bd0ec556e318f1dd26e772dd7ba65df82ff7aa07b5c3f8da6dad387a4de5bdcbef05774899c16b4aeaf70fe6dec
6
+ metadata.gz: 5f66811b21dba8a5c200858efbb942b76cc8207f97c2d077b15bfbbd9402ed0168c86910f6c53ac438d4db50b8b7e7b61eb85803892e4a64b35d4b609dc43fb7
7
+ data.tar.gz: 56c020ddaf5bb2ca928c7eb03d733f0bad177323593ed8f8ab6e5b5294888de2cb1326441d5c56057acb84eec887ede1b554cc593b324748d0d38e899708b54a
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2017 CustomInk.com
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -99,10 +99,26 @@ module InContactClient
99
99
  return item if item.blank? || data_model_override.is_a?(FalseClass)
100
100
 
101
101
  # Change keys to snake case
102
- item.deep_transform_keys! { |key| key.underscore }
102
+ item = underscore_hash_keys(item)
103
103
  data_model_klass = data_model_override || default_data_model
104
104
  return item if data_model_klass.nil?
105
105
  data_model_klass.new(item)
106
106
  end
107
+
108
+ # Based on ActiveSupport's Hash#deep_transform_keys, which is only available in
109
+ # versions >= 4.0.2. We'll port it here to work with versions < 4.0.2
110
+ # Source: https://github.com/rails/rails/blob/55f9b8129a50206513264824abb44088230793c2/activesupport/lib/active_support/core_ext/hash/keys.rb#L143-L154
111
+ def underscore_hash_keys(item)
112
+ case item
113
+ when Hash
114
+ item.each_with_object({}) do |(key, value), result|
115
+ result[key.underscore] = underscore_hash_keys(value)
116
+ end
117
+ when Array
118
+ item.map { |value| underscore_hash_keys(value) }
119
+ else
120
+ item
121
+ end
122
+ end
107
123
  end
108
124
  end
@@ -1,3 +1,3 @@
1
1
  module InContactClient
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: incontact_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Tennity
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-22 00:00:00.000000000 Z
11
+ date: 2017-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -147,6 +147,7 @@ files:
147
147
  - ".gitignore"
148
148
  - ".travis.yml"
149
149
  - Gemfile
150
+ - LICENSE.txt
150
151
  - README.md
151
152
  - Rakefile
152
153
  - docs/agent_sessions.md