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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9db4d6e8cbb471389eac3e6dd348977a037b38d0
4
- data.tar.gz: a8e73e33bfc15789bc93981bca93ee245b04e7f1
3
+ metadata.gz: e07435868f28609c59ac3a5f2844ffb06f1253f6
4
+ data.tar.gz: 21404aafe3eb65dde48d302c096c9f9d39327178
5
5
  SHA512:
6
- metadata.gz: 74a19740ce41bb220b36d535d9c22c851e935a711917273756bec8dc74ec3556aa6e060579b0c8522439fb84d0df4d31cb49e1fc6122d618351440ac6d7ab1a1
7
- data.tar.gz: 491ab5a67536d45fd9c693492806fa0af7c939e09b1a1da9d49dc06dcb8dc6b1c6e545f527e6c58a1f8718b65848b188285557f6bb3cd978895ee2b77147828e
6
+ metadata.gz: 3e34054421d567dcc996714bd9674effb36b63b82bc2a57516359902980333d3c01b6f6d6d36e66c09f43a5dffb858aa0498137364bdea5d684c845598ad6715
7
+ data.tar.gz: 746a0d58d0827682feb8961f217b961a968c6da55e85ba3c9080f54e47a202a633c009a71b05d7188a5b8d8a3594233215126b6d42f90d052420326b7e1d241f
@@ -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(path_prefix: proxy_path, api_key: api_key))
21
+ proxy_class.get(path, params.merge(extra_params))
15
22
  end
16
23
 
17
24
  def all
18
- proxy_class.all(path_prefix: proxy_path, api_key: api_key)
25
+ proxy_class.all(extra_params)
19
26
  end
20
27
 
21
28
  def new(attrs = {})
22
- proxy_class.new(attrs.merge(path_prefix: proxy_path, api_key: api_key))
29
+ proxy_class.new(attrs.merge(extra_params))
23
30
  end
24
31
  end
25
32
  end
data/lib/tito/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tito
2
- VERSION = "0.2.6"
2
+ VERSION = "0.2.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tito
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Campbell