eventbrite_sdk 3.3.1 → 3.4.0

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: 27b750424227327d4fce8d8ef5d7505450675762
4
- data.tar.gz: 4bf8748ce4f7f4bb1c7f2bb57ab0a61f8b1718ee
3
+ metadata.gz: 2c1e67123425f40c0f27d858eb440c95f5a19d2d
4
+ data.tar.gz: a7e48208c305d9bc8e89525c73097114bd6821f5
5
5
  SHA512:
6
- metadata.gz: 7ce16716f2de97848693781c2319ca4a09e648c7551b54bfc17eb30397f26dee9cd9a37c9819ce6ca925c1b0eaac419320bf1d1b181c3fda98f326e46d1e8bb5
7
- data.tar.gz: 3b06b5f615ccc5ad0dd0b8956ed679a10f4a122b11a8b8bcea8925c25d4a8a867bea1a799e9c1b958655446437b98459d4bf51b7e4874b35332ce682c45870b8
6
+ metadata.gz: c40cc4297d6aa7c915ff70c5580b4c32f2193191eaec752e69bef68d5912d9156bf3d8187ae5fcbf7cc9c5f5c1e0b592b09c939b9c7813f83cbba48db1538e25
7
+ data.tar.gz: 8d1b496743e38f269e3c8cd23b843ac47c185b7d825294c810ec5937ad22bb20f67fcade02a4efa4b948c31d717813ea1bb28aac6bb862104322e70aa4b38ac9
data/README.md CHANGED
@@ -91,6 +91,16 @@ events = user.owned_events.page(1) => events = user.owned_events
91
91
  events.first => events[0]
92
92
  events.last => events[-1]
93
93
 
94
+ # endpoints that support continuations: will be inferred from the current payload
95
+ # you can tell if a paginated result set supports continuations by checking for a non-nil #continuation
96
+
97
+ example.continuation #=> "dGhpcyBpcyBwYWdlIDE"
98
+
99
+ # you can continue until the example returns nil, which means there are no more items
100
+ example.continue
101
+
102
+ # you can also provide a token if you choose to do so
103
+ example.continue(continuation_token: 'my_token')
94
104
  ```
95
105
  # Construct endpoint paths:
96
106
 
@@ -24,6 +24,17 @@ module EventbriteSDK
24
24
  other.concat(to_ary)
25
25
  end
26
26
 
27
+ def continue(continuation_token: nil, api_token: nil)
28
+ continuation_token ||= continuation
29
+
30
+ return unless continuation_token || has_more_items
31
+
32
+ retrieve(
33
+ api_token: api_token,
34
+ query: {continuation: continuation_token}
35
+ )
36
+ end
37
+
27
38
  def retrieve(query: {}, api_token: nil)
28
39
  @query.merge!(query)
29
40
  load_response(api_token)
@@ -32,21 +43,22 @@ module EventbriteSDK
32
43
  end
33
44
 
34
45
  def page(num, api_token: nil)
35
- pagination['page_number'] = num
36
-
37
- retrieve(api_token: api_token)
46
+ retrieve(
47
+ api_token: api_token,
48
+ query: { page: num },
49
+ )
38
50
  end
39
51
 
40
52
  def next_page(api_token: nil)
41
53
  return if page_number >= (page_count || 1)
42
54
 
43
- page(pagination['page_number'] + 1, api_token: api_token)
55
+ page(page_number + 1, api_token: api_token)
44
56
  end
45
57
 
46
58
  def prev_page(api_token: nil)
47
59
  return if page_number <= 1
48
60
 
49
- page(pagination['page_number'] - 1, api_token: api_token)
61
+ page(page_number - 1, api_token: api_token)
50
62
  end
51
63
 
52
64
  %w[
@@ -93,11 +105,7 @@ module EventbriteSDK
93
105
  end
94
106
 
95
107
  def load_response(api_token)
96
- response = request.get(
97
- url: url_base,
98
- query: { page: page_number }.merge(query),
99
- api_token: api_token
100
- )
108
+ response = request.get(api_token: api_token, query: query.dup, url: url_base)
101
109
 
102
110
  @objects = (response[key.to_s] || []).map { |raw| object_class.new(raw) }
103
111
  @pagination = response['pagination']
@@ -1,5 +1,5 @@
1
1
  module EventbriteSDK
2
2
  # Major should always line up with the major point release of the public API
3
3
  # v3 => 3.x.x
4
- VERSION = '3.3.1'.freeze
4
+ VERSION = '3.4.0'.freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventbrite_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.1
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vinnie Franco
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-03-01 00:00:00.000000000 Z
13
+ date: 2018-11-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  version: '0'
168
168
  requirements: []
169
169
  rubyforge_project:
170
- rubygems_version: 2.5.2
170
+ rubygems_version: 2.6.14
171
171
  signing_key:
172
172
  specification_version: 4
173
173
  summary: Official Eventbrite SDK for the v3 API