tito 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tito/request_proxy.rb +11 -4
- data/lib/tito/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e07435868f28609c59ac3a5f2844ffb06f1253f6
|
4
|
+
data.tar.gz: 21404aafe3eb65dde48d302c096c9f9d39327178
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e34054421d567dcc996714bd9674effb36b63b82bc2a57516359902980333d3c01b6f6d6d36e66c09f43a5dffb858aa0498137364bdea5d684c845598ad6715
|
7
|
+
data.tar.gz: 746a0d58d0827682feb8961f217b961a968c6da55e85ba3c9080f54e47a202a633c009a71b05d7188a5b8d8a3594233215126b6d42f90d052420326b7e1d241f
|
data/lib/tito/request_proxy.rb
CHANGED
@@ -7,19 +7,26 @@ module Tito
|
|
7
7
|
def initialize(proxy_class: nil, proxy_path: nil, api_key: nil)
|
8
8
|
@proxy_path = proxy_path
|
9
9
|
@proxy_class = proxy_class
|
10
|
-
@api_key = api_key
|
10
|
+
@api_key = api_key || Tito.api_key
|
11
|
+
end
|
12
|
+
|
13
|
+
def extra_params
|
14
|
+
{}.tap do |_extra_params|
|
15
|
+
_extra_params[:path_prefix] = proxy_path if proxy_path.to_s != ''
|
16
|
+
_extra_params[:api_key] = api_key if api_key.to_s != ''
|
17
|
+
end
|
11
18
|
end
|
12
19
|
|
13
20
|
def get(path, params = {})
|
14
|
-
proxy_class.get(path, params.merge(
|
21
|
+
proxy_class.get(path, params.merge(extra_params))
|
15
22
|
end
|
16
23
|
|
17
24
|
def all
|
18
|
-
proxy_class.all(
|
25
|
+
proxy_class.all(extra_params)
|
19
26
|
end
|
20
27
|
|
21
28
|
def new(attrs = {})
|
22
|
-
proxy_class.new(attrs.merge(
|
29
|
+
proxy_class.new(attrs.merge(extra_params))
|
23
30
|
end
|
24
31
|
end
|
25
32
|
end
|
data/lib/tito/version.rb
CHANGED