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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 16a62048aa94feb842642a5399d49f5a9d39b27a
4
- data.tar.gz: 647034874eab8db972bc7488c3028c57573f34ad
3
+ metadata.gz: 8cae275a1c252132bdf5816bd1461c612fcf2740
4
+ data.tar.gz: 3b66fba0cf486366f2985360dc812b269273e2e6
5
5
  SHA512:
6
- metadata.gz: 481061140823e82479caeda288bad17b9ce80328acbab3e59d21d985c6d19b4dec7fb846746bbb0ed0a52376d65a67a8efcd8d4cf4e06293bdd599a3463736ca
7
- data.tar.gz: 79bf9fdce64ef90338130f5ae7001e4ef0d048d85a909aeebc081ca206801303fdfb03ca4695b78af0528f51f8bfd1f5e8ef7f203d7386e3ac4d3ebd49a1d202
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', start_date: …, end_date:
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:
@@ -82,15 +82,7 @@ module Chiketto
82
82
  end
83
83
 
84
84
  def self.paginated_attendees(id, params)
85
- page = 0
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
@@ -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
@@ -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
- page = 0
42
- events = []
43
- loop do
44
- page += 1
45
- response = User.find_events id, params.merge(page: page.to_s)
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
@@ -1,3 +1,3 @@
1
1
  module Chiketto
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -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.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-26 00:00:00.000000000 Z
11
+ date: 2015-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler