tito 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tito/eventable.rb +16 -3
- 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: bbcfc2e33a486952025a18c74a0d7d5ea16a9eaf
|
4
|
+
data.tar.gz: 00dac2e1cbafaf7db2b62e307392e4e578c38992
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f73f2adb05d5fece4893ff3662c7c23f3f9cf9d615c939873ca9c073116b631f6d74a7246d885841772e3cb7fa71604524a64f0854ac0b46990e37102c623c5
|
7
|
+
data.tar.gz: dbddf26fd4a90bb00241ffb3204bf172733fe64b10462b26d1a7efebda02b864aff2e269368919b235a07292d0c10abebaf43a2b2fa7cc3cffe943942233e173
|
data/lib/tito/eventable.rb
CHANGED
@@ -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
|
23
|
-
path_params[:account_id] = params
|
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 <<
|
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
|
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.1.
|
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-
|
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
|