chiketto 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/chiketto/event.rb +1 -9
- data/lib/chiketto/resource.rb +12 -0
- data/lib/chiketto/user.rb +14 -9
- data/lib/chiketto/version.rb +1 -1
- data/test/user_test.rb +8 -0
- 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: 8cae275a1c252132bdf5816bd1461c612fcf2740
|
4
|
+
data.tar.gz: 3b66fba0cf486366f2985360dc812b269273e2e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5138116f633dd6a66f6145185198e23c63075b63abc66809dbfd452e88bc2f77700f127ead49a21b6a8765ef40e96fe1bd8e1d9d565319334726464354edb1a3
|
7
|
+
data.tar.gz: f2bb97b2eaf74af53c4f9537ec4ada42a00e882a4525e595ed9aab67984fc654b1758005d988714400ec7b2a9d6c27d233cf42dbc2e633e4d950c16b397a7200
|
data/README.md
CHANGED
@@ -70,8 +70,8 @@ event.organizer.name # => 'Organizer Name'
|
|
70
70
|
You can also create new events, or update existing events (using the V1 API) and Chiketto will then return the updated / new event pulled from the V3 API.
|
71
71
|
|
72
72
|
```ruby
|
73
|
-
event.update name: 'Name'
|
74
|
-
Chiketto::Event.create name: 'Name',
|
73
|
+
event.update 'event.name.html': 'Name'
|
74
|
+
Chiketto::Event.create 'event.name.html': 'Name', 'event.start.timezone': 'Europe/London', 'event.start.utc': …, 'event.end.utc': …, 'event.end.timezone': …, 'event.currency': 'GBP'
|
75
75
|
```
|
76
76
|
|
77
77
|
You can also use the search endpoint on the API to look up events and have an Array of events returned:
|
data/lib/chiketto/event.rb
CHANGED
@@ -82,15 +82,7 @@ module Chiketto
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def self.paginated_attendees(id, params)
|
85
|
-
|
86
|
-
attendees = []
|
87
|
-
loop do
|
88
|
-
page += 1
|
89
|
-
response = Event.find_attendees id, params.merge(page: page.to_s)
|
90
|
-
attendees.concat response['attendees']
|
91
|
-
break unless should_paginate(response['pagination'])
|
92
|
-
end
|
93
|
-
attendees
|
85
|
+
paginated(:attendees, id, params)
|
94
86
|
end
|
95
87
|
end
|
96
88
|
end
|
data/lib/chiketto/resource.rb
CHANGED
@@ -53,5 +53,17 @@ module Chiketto
|
|
53
53
|
def self.should_paginate(pagination)
|
54
54
|
pagination['page_count'] > pagination['page_number']
|
55
55
|
end
|
56
|
+
|
57
|
+
def self.paginated(resource, id, params)
|
58
|
+
page = 0
|
59
|
+
resources = []
|
60
|
+
loop do
|
61
|
+
page += 1
|
62
|
+
response = self.send("find_#{resource}", id, params.merge(page: page.to_s))
|
63
|
+
resources.concat response[resource.to_s]
|
64
|
+
break unless should_paginate(response['pagination'])
|
65
|
+
end
|
66
|
+
resources
|
67
|
+
end
|
56
68
|
end
|
57
69
|
end
|
data/lib/chiketto/user.rb
CHANGED
@@ -22,6 +22,11 @@ module Chiketto
|
|
22
22
|
events.map { |e| Event.new e }
|
23
23
|
end
|
24
24
|
|
25
|
+
def event_attendees(params = {})
|
26
|
+
attendees = User.paginated_attendees @id, params
|
27
|
+
attendees.map { |e| Attendee.new e }
|
28
|
+
end
|
29
|
+
|
25
30
|
def organizers
|
26
31
|
organizers = User.find_organizers @id
|
27
32
|
organizers['organizers'].map { |o| Organizer.new o }
|
@@ -29,6 +34,10 @@ module Chiketto
|
|
29
34
|
|
30
35
|
private
|
31
36
|
|
37
|
+
def self.find_attendees(id, params)
|
38
|
+
get "users/#{id}/owned_event_attendees", params
|
39
|
+
end
|
40
|
+
|
32
41
|
def self.find_events(id, params)
|
33
42
|
get "users/#{id}/owned_events", params
|
34
43
|
end
|
@@ -38,15 +47,11 @@ module Chiketto
|
|
38
47
|
end
|
39
48
|
|
40
49
|
def self.paginated_events(id, params)
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
events.concat response['events']
|
47
|
-
break unless should_paginate(response['pagination'])
|
48
|
-
end
|
49
|
-
events
|
50
|
+
paginated(:events, id, params)
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.paginated_attendees(id, params)
|
54
|
+
paginated(:attendees, id, params)
|
50
55
|
end
|
51
56
|
end
|
52
57
|
end
|
data/lib/chiketto/version.rb
CHANGED
data/test/user_test.rb
CHANGED
@@ -49,6 +49,14 @@ class UserTest < MiniTest::Test
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
def test_user_has_event_attendees
|
53
|
+
find_me
|
54
|
+
|
55
|
+
VCR.use_cassette 'user-event-attendees' do
|
56
|
+
assert_kind_of Chiketto::Attendee, @user.event_attendees.first
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
52
60
|
def test_user_has_organizers
|
53
61
|
find_me
|
54
62
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chiketto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Radford
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|