tito 0.2.10 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tito/base.rb +24 -1
- data/lib/tito/version.rb +1 -1
- 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: e34e55d8b9e64712ebc304b6165651ce36baa6c6
|
4
|
+
data.tar.gz: 138098dfbc71edbac3ceef3f7c2280b94fb06e35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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.
|
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-
|
11
|
+
date: 2017-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|