chiketto 0.4.1 → 0.4.2

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: 57f5b5eb3b13728ffb85f6a2146f052797e30749
4
- data.tar.gz: 9be3fabc76bbe6a770845fc0ab68bcc267485f66
3
+ metadata.gz: f003de4b80d524222a005ef12e9b7cfa1dd079c3
4
+ data.tar.gz: fb4c106c1721c81f701cb31d1e944bce1283c1e9
5
5
  SHA512:
6
- metadata.gz: e29c673598647b3e60d3a70d91b8dc4cbfa8f9ba846acf1f2f86261cd922a40e6689a29e3f73c0448577a997b869cab2d52f3d0fc9e64f0a484ad6f700254159
7
- data.tar.gz: 71f85706f0d623053197bb3af0a59bc88d76094f890376354b0b85f18b8e593fc41911600f1dd44f0254261bb931a68af4c884fd6c25a0ea09ce34914dcd0bc0
6
+ metadata.gz: 43508152781d540edcee40a2b4a04595b1e2986901dd92180911b93631916093236751e5df96e8e6c0e494ab781ea11d20561a7646d083641999e298ce3c3913
7
+ data.tar.gz: b3e3c6356b89f30a451ef1b83568806c6a0c53a6eba4dd2de299a19a54facc0f4132722086ee77dea24ae22d46719651ae9323a7bd326af9d63bdf9f1aedd612
@@ -35,8 +35,8 @@ module Chiketto
35
35
  end
36
36
 
37
37
  def attendees(params = {})
38
- attendees = Event.find_attendees @id, params
39
- attendees['attendees'].map { |att| Attendee.new att }
38
+ attendees = Event.paginated_attendees @id, params
39
+ attendees.map { |att| Attendee.new att }
40
40
  end
41
41
 
42
42
  def organizer
@@ -67,5 +67,19 @@ module Chiketto
67
67
  def self.find_attendees(id, params)
68
68
  get "events/#{id}/attendees", params
69
69
  end
70
+
71
+ def self.paginated_attendees(id, params, page = 1, attendees = [])
72
+ response = Event.find_attendees id, params.merge(page: page.to_s)
73
+ attendees.concat response['attendees']
74
+ if should_paginate(response['pagination'])
75
+ Event.paginated_attendees id, params, page + 1, attendees
76
+ else
77
+ attendees
78
+ end
79
+ end
80
+
81
+ def self.should_paginate(pagination)
82
+ pagination['page_count'] > pagination['page_number']
83
+ end
70
84
  end
71
85
  end
@@ -1,3 +1,3 @@
1
1
  module Chiketto
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
data/test/event_test.rb CHANGED
@@ -91,6 +91,7 @@ class EventTest < MiniTest::Test
91
91
  @attendees = @event.attendees
92
92
  end
93
93
  assert_kind_of Array, @attendees
94
+ refute @attendees.empty?, 'Should return more than 0 attendees'
94
95
  end
95
96
 
96
97
  def test_attendees_returns_an_array_of_attendees_attending
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: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Radford
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-29 00:00:00.000000000 Z
11
+ date: 2014-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler