tito 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -0
- data/lib/tito/account.rb +1 -0
- data/lib/tito/event.rb +13 -17
- data/lib/tito/eventable.rb +32 -0
- data/lib/tito/oauth2_middleware.rb +1 -1
- data/lib/tito/version.rb +1 -1
- data/lib/tito/webhook_endpoint.rb +2 -3
- data/lib/tito.rb +1 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd8ca9fe94ea995499e3b1c204ff40313809eb59
|
4
|
+
data.tar.gz: bd442ad3ba07d49dfaa95996e3c5fe571498fd0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ab0f72cc9fc66873d6ab09c8f8c800006a2b109995bbab5f71a41175009c9e5d072fb968ea519dbec33536a26166eb1333f9f93db0ed41d88dd586a63069d6a
|
7
|
+
data.tar.gz: 50963475ff5ce2c15585dfe3c3062cdc2f1d159186faf23c8d1085ead52b9ebce1f4142c321c644cdc89b5cce5f642f30e3a70f5b496359e12749656486acee3
|
data/Gemfile
CHANGED
data/lib/tito/account.rb
CHANGED
data/lib/tito/event.rb
CHANGED
@@ -3,6 +3,19 @@ module Tito
|
|
3
3
|
belongs_to :account
|
4
4
|
|
5
5
|
property :title, type: :string
|
6
|
+
property :security_token, type: :string
|
7
|
+
|
8
|
+
def account_id
|
9
|
+
attributes['account_id'] || attributes['account-id']
|
10
|
+
end
|
11
|
+
|
12
|
+
def account_id=(val)
|
13
|
+
attributes['account_id'] = val
|
14
|
+
end
|
15
|
+
|
16
|
+
def security_token
|
17
|
+
attributes['security_token'] || attributes['security-token']
|
18
|
+
end
|
6
19
|
|
7
20
|
class << self
|
8
21
|
|
@@ -19,26 +32,9 @@ module Tito
|
|
19
32
|
parts << 'events'
|
20
33
|
end
|
21
34
|
File.join(*parts)
|
22
|
-
# parts = ['%{account_id}', '%{id}']
|
23
|
-
# if params
|
24
|
-
# path_params = params.delete(:path) || params
|
25
|
-
# parts.unshift(_prefix_path % path_params.symbolize_keys)
|
26
|
-
# else
|
27
|
-
# parts.unshift(_prefix_path)
|
28
|
-
# end
|
29
|
-
# parts.reject!{|part| part == "" }
|
30
|
-
# File.join(*parts)
|
31
35
|
rescue KeyError
|
32
36
|
raise ArgumentError, "Please make sure to include account_id"
|
33
37
|
end
|
34
|
-
|
35
|
-
# def path(params=nil)
|
36
|
-
# if params[:id].blank?
|
37
|
-
# ['%account_id', 'events'].compact.join('/')
|
38
|
-
# else
|
39
|
-
# '%account_id'
|
40
|
-
# end
|
41
|
-
# end
|
42
38
|
end
|
43
39
|
end
|
44
40
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Tito
|
2
|
+
module Eventable
|
3
|
+
|
4
|
+
def self.included(base)
|
5
|
+
base.extend ClassMethods
|
6
|
+
base.class_eval do
|
7
|
+
property :event
|
8
|
+
property :event_id
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def event=(tito_event)
|
13
|
+
self.event_id = tito_event.id
|
14
|
+
self.attributes[:event] = tito_event
|
15
|
+
@event = tito_event
|
16
|
+
end
|
17
|
+
|
18
|
+
module ClassMethods
|
19
|
+
def path(params=nil)
|
20
|
+
prefix_path = '%{account_id}/%{event_id}'
|
21
|
+
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']
|
24
|
+
parts = [].unshift(prefix_path % path_params.symbolize_keys)
|
25
|
+
parts << params[:type]
|
26
|
+
File.join(*parts)
|
27
|
+
rescue KeyError
|
28
|
+
raise ArgumentError, "Please make sure to include account_id and event_id"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -13,7 +13,7 @@ module Tito
|
|
13
13
|
|
14
14
|
if token.respond_to?(:empty?) && !token.empty?
|
15
15
|
env[:url].query = build_query params
|
16
|
-
env[:request_headers][AUTH_HEADER] ||= %(
|
16
|
+
env[:request_headers][AUTH_HEADER] ||= %(Bearer #{token})
|
17
17
|
end
|
18
18
|
|
19
19
|
@app.call env
|
data/lib/tito/version.rb
CHANGED
data/lib/tito.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.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:
|
11
|
+
date: 2016-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json_api_client
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- lib/tito/account.rb
|
73
73
|
- lib/tito/base.rb
|
74
74
|
- lib/tito/event.rb
|
75
|
+
- lib/tito/eventable.rb
|
75
76
|
- lib/tito/oauth2_middleware.rb
|
76
77
|
- lib/tito/version.rb
|
77
78
|
- lib/tito/webhook_endpoint.rb
|
@@ -97,9 +98,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
98
|
version: '0'
|
98
99
|
requirements: []
|
99
100
|
rubyforge_project:
|
100
|
-
rubygems_version: 2.
|
101
|
+
rubygems_version: 2.5.1
|
101
102
|
signing_key:
|
102
103
|
specification_version: 4
|
103
104
|
summary: Consumer library for Tito API
|
104
105
|
test_files: []
|
105
|
-
has_rdoc:
|