chiketto 0.4.8 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chiketto/event.rb +9 -11
- data/lib/chiketto/resource.rb +4 -0
- data/lib/chiketto/user.rb +14 -2
- data/lib/chiketto/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: 2d3c982cc44a739bfced986438e2c622e3ea8fa8
|
4
|
+
data.tar.gz: c82350ae60fe519bbe9aa6839ac1933a9e454176
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee1253d5e183e441d3d664e62c3897dfb345e0f2c1351a650795bece8d569fc5970c2c61dde2d012750fed4035974ccfe2edeac7eeea0e60ab20418f885568d0
|
7
|
+
data.tar.gz: 28c12c5b26dc440daff2d703bed88a1d2a59307935f0c89d1161caf1fded0523149d522944b5a34ad192315ce9f6469678dc027cadacbdea0ece5b0813d6ef06
|
data/lib/chiketto/event.rb
CHANGED
@@ -88,18 +88,16 @@ module Chiketto
|
|
88
88
|
get "events/#{id}/attendees", params
|
89
89
|
end
|
90
90
|
|
91
|
-
def self.paginated_attendees(id, params
|
92
|
-
|
93
|
-
attendees
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
attendees
|
91
|
+
def self.paginated_attendees(id, params)
|
92
|
+
page = 0
|
93
|
+
attendees = []
|
94
|
+
loop do
|
95
|
+
page += 1
|
96
|
+
response = Event.find_attendees id, params.merge(page: page.to_s)
|
97
|
+
attendees.concat response['attendees']
|
98
|
+
break unless should_paginate(response['pagination'])
|
98
99
|
end
|
99
|
-
|
100
|
-
|
101
|
-
def self.should_paginate(pagination)
|
102
|
-
pagination['page_count'] > pagination['page_number']
|
100
|
+
attendees
|
103
101
|
end
|
104
102
|
end
|
105
103
|
end
|
data/lib/chiketto/resource.rb
CHANGED
data/lib/chiketto/user.rb
CHANGED
@@ -18,8 +18,8 @@ module Chiketto
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def events(params = {})
|
21
|
-
events = User.
|
22
|
-
events
|
21
|
+
events = User.paginated_events @id, params
|
22
|
+
events.map { |e| Event.new e }
|
23
23
|
end
|
24
24
|
|
25
25
|
def organizers
|
@@ -36,5 +36,17 @@ module Chiketto
|
|
36
36
|
def self.find_organizers(id)
|
37
37
|
get "users/#{id}/organizers"
|
38
38
|
end
|
39
|
+
|
40
|
+
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
|
+
end
|
39
51
|
end
|
40
52
|
end
|
data/lib/chiketto/version.rb
CHANGED
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.
|
4
|
+
version: 0.4.9
|
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-02-
|
11
|
+
date: 2015-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|