clearbit 0.0.9 → 0.1.0

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: 4f5e4a396bb4c63c54f1714a61920f2254efe41e
4
- data.tar.gz: def906db0d2c3e8b1da72e327d1bad7717564648
3
+ metadata.gz: 9a3cdccc9a76f5753301844526a4ee0b739e2177
4
+ data.tar.gz: 28d4b914401787f4aa352c187f7cf72f1049e7d4
5
5
  SHA512:
6
- metadata.gz: 6f08d58bd7496d8f3a123d064dfb73a23849498916c74f14ae8996b882a04e0b38430c0c852d9c81aa2ceaba1179b63a726a27375d0549b153d513eba9f82a57
7
- data.tar.gz: 2d9e45d12cbd372582a980bee355c546c3b05cc3a6eb77cb7807f478776df49803841db1323560ba486fb6ad03cc4d1ea914493789c1e0cfc14176a11b9f8f58
6
+ metadata.gz: 805deb5d946a10a2f9e2709c402469a305fffabdb5a3874b78952107906a4521aece70423a80d5aa46c0cbf3e7a5a1f74743f7fb0892f484cb5fc2847bd6c96a
7
+ data.tar.gz: 44828fc7c16005f06370c079dfde0aceb381a36f8325858f610acfb4c27f28928b687fb6770b74445be79f6a9a7435c8f4f3ffec8e948c782be18d9d40ed6d57
@@ -1,6 +1,4 @@
1
1
  require 'clearbit'
2
2
  require 'pp'
3
3
 
4
- Clearbit.api_key = ENV['CLEARBIT_KEY_LOCAL']
5
-
6
4
  pp Clearbit::Person[email: 'info@eribium.org']
@@ -21,4 +21,8 @@ module Clearbit
21
21
  autoload :Resource, 'clearbit/resource'
22
22
  autoload :Streaming, 'clearbit/streaming'
23
23
  autoload :Watchlist, 'clearbit/watchlist'
24
+
25
+ if clearbit_key = ENV['CLEARBIT_KEY']
26
+ Clearbit.key = clearbit_key
27
+ end
24
28
  end
@@ -142,7 +142,17 @@ module Clearbit
142
142
 
143
143
  def method_missing(method_name, *args, &blk)
144
144
  return self.[](method_name, &blk) if key?(method_name)
145
+
146
+ underscored_name = underscore(method_name.to_s)
147
+
148
+ if key?(underscored_name)
149
+ warn 'camelCased property names are deprecated. ' + '
150
+ Please use underscored properties.'
151
+ return self.[](underscored_name, &blk)
152
+ end
153
+
145
154
  match = method_name.to_s.match(/(.*?)([?=!_]?)$/)
155
+
146
156
  case match[2]
147
157
  when "="
148
158
  self[match[1]] = args.first
@@ -159,8 +169,17 @@ module Clearbit
159
169
 
160
170
  protected
161
171
 
172
+ def underscore(camel_cased_word)
173
+ word = camel_cased_word.to_s.gsub('::', '/')
174
+ word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
175
+ word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
176
+ word.tr!("-", "_")
177
+ word.downcase!
178
+ word
179
+ end
180
+
162
181
  def convert_key(key) #:nodoc:
163
- key.to_s
182
+ underscore(key.to_s)
164
183
  end
165
184
 
166
185
  def convert_value(val, duping=false) #:nodoc:
@@ -1,3 +1,3 @@
1
1
  module Clearbit
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clearbit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex MacCaw
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-24 00:00:00.000000000 Z
11
+ date: 2014-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler