tito 0.1.8 → 0.1.9

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: d0cc60e74e048a8f1d1b5774851440161bb367e0
4
- data.tar.gz: 8cad39c5b9f2e5f8bb01043deebae07b63885b4d
3
+ metadata.gz: bbcfc2e33a486952025a18c74a0d7d5ea16a9eaf
4
+ data.tar.gz: 00dac2e1cbafaf7db2b62e307392e4e578c38992
5
5
  SHA512:
6
- metadata.gz: 5767602b6e339e10470f493ed0858674a95a0b8ff06e8b2b21bb7d0dc02e19dc02575e48d8345ccd1772f4e75a3c6b68a13cfed3e3c96bab264e14b85bbaafaa
7
- data.tar.gz: 0e1aa3256e59d45eccc8bbaa4396694bef3feadc777893531604f1101a84af440da318a66c36e5f7a474516c17396aa4b2143c40afe23d6cffd5efba5b128fd3
6
+ metadata.gz: 4f73f2adb05d5fece4893ff3662c7c23f3f9cf9d615c939873ca9c073116b631f6d74a7246d885841772e3cb7fa71604524a64f0854ac0b46990e37102c623c5
7
+ data.tar.gz: dbddf26fd4a90bb00241ffb3204bf172733fe64b10462b26d1a7efebda02b864aff2e269368919b235a07292d0c10abebaf43a2b2fa7cc3cffe943942233e173
@@ -16,14 +16,27 @@ module Tito
16
16
  end
17
17
 
18
18
  module ClassMethods
19
+
20
+ def event_id_from_params(params)
21
+ return params[:event][:id] if params[:event]
22
+ return params[:filter][:event_id] if params[:filter]
23
+ end
24
+
25
+ def account_id_from_params(params)
26
+ return params[:event][:account_id] if params[:event]
27
+ return params[:filter][:account_id] if params[:filter]
28
+ end
29
+
19
30
  def path(params=nil)
20
31
  prefix_path = '%{account_id}/%{event_id}'
21
32
  path_params = params.delete(:path) || params
22
- path_params[:event_id] = params[:event][:id]
23
- path_params[:account_id] = params[:event][:account_id] || params[:event]['account-id']
33
+ path_params[:event_id] = event_id_from_params(params)
34
+ path_params[:account_id] = account_id_from_params(params)
24
35
  parts = [].unshift(prefix_path % path_params.symbolize_keys)
25
- parts << params[:type]
36
+ parts << table_name
37
+
26
38
  File.join(*parts)
39
+
27
40
  rescue KeyError
28
41
  raise ArgumentError, "Please make sure to include account_id and event_id"
29
42
  end
@@ -1,3 +1,3 @@
1
1
  module Tito
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
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.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Campbell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-01 00:00:00.000000000 Z
11
+ date: 2016-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json_api_client