tito 0.2.10 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tito/base.rb +24 -1
  3. data/lib/tito/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9efdfebcb98de4809e96644cb86c6af3f03ecce3
4
- data.tar.gz: 6f72b5796c0554e005565a0fc539861cec150d85
3
+ metadata.gz: e34e55d8b9e64712ebc304b6165651ce36baa6c6
4
+ data.tar.gz: 138098dfbc71edbac3ceef3f7c2280b94fb06e35
5
5
  SHA512:
6
- metadata.gz: 5cab6903f1eae53e6041b8fb876e2e023634eebc140dfd641679137ddfd84132b1a3535c16cae99a30f0f91baeb73f92b8ed75d96c56e4fdc6af838699d43a70
7
- data.tar.gz: 5b379587c7231d95fbe90a34cba376be81e10cf71a1a77a5219bff8da507ca504f10f0147e89a39af959215881929248868858e5ef055b0a9184c48260123020
6
+ metadata.gz: f02347c970aa2b094ea79404f5055dc0128cccaafcbb89fb04638821d6b0ebc08efd004eecfff2886c7bc94bf1b9e4e380c76ebee62f03007fe19c3f3ed6592c
7
+ data.tar.gz: e3fc61fbf4197b7e2e76cdf6befb880f187b4f5c3889fe9a8569d10b9f91339fcf97040f653a634cff20a3c5999a9a96b4f44f6fead322afc4101cfdf2c5736f
data/lib/tito/base.rb CHANGED
@@ -31,7 +31,7 @@ module Tito
31
31
  end
32
32
 
33
33
  def self.http(api_key: nil)
34
- HTTP.auth(auth(api_key: api_key)).accept("application/json")
34
+ HTTP[user_agent: "Tito Ruby API #{Tito::VERSION}"].auth(auth(api_key: api_key)).accept("application/json")
35
35
  end
36
36
 
37
37
  def self.resource_path=(val)
@@ -156,5 +156,28 @@ module Tito
156
156
  def destroy(api_key: nil)
157
157
  http(api_key: api_key).delete(put_url, ssl_context: ssl_context)
158
158
  end
159
+
160
+ # cf. https://github.com/sumofparts/lifter/commit/e224946538ea0be337b7418c2946dbf1c2018b6b
161
+ module ParamNester
162
+ def self.encode(value, key = nil, out_hash = {})
163
+ case value
164
+ when Hash
165
+ value.each { |k,v| encode(v, append_key(key, k), out_hash) }
166
+ out_hash
167
+ when Array
168
+ value.each { |v| encode(v, "#{key}[]", out_hash) }
169
+ out_hash
170
+ when nil
171
+ ''
172
+ else
173
+ out_hash[key] = value
174
+ out_hash
175
+ end
176
+ end
177
+
178
+ def self.append_key(root_key, key)
179
+ root_key.nil? ? :"#{key}" : :"#{root_key}[#{key.to_s}]"
180
+ end
181
+ end
159
182
  end
160
183
  end
data/lib/tito/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tito
2
- VERSION = "0.2.10"
2
+ VERSION = "0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tito
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: '0.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Campbell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-20 00:00:00.000000000 Z
11
+ date: 2017-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http