big_marker_client 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ae319a03754f05c2928906fefa27dbfdf3e19fad1a0bc6f12d1711760451a8b
|
4
|
+
data.tar.gz: b6682c4b5c54470b6aadfeaf0ae88fcca0c37a98ce001b2eb4c88fd8c1c70bea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d19877b53cad7224ef8a1c9af5689510e7d42f9bcb5abaf536ffd1a511d3ba04e562e0568a874bfe3e36295ec84df26094f378b6aac3b16f91daa486cccad196
|
7
|
+
data.tar.gz: 9154f4eec680cb10f429c85fd3cd85fd1bd57aed2407350b49601488e24e3899b4d69b40930ec90b98cedf58f6d3f2c85ad17b0f3e1f12b6e04a65046d9842dc
|
data/CHANGELOG.md
CHANGED
@@ -24,6 +24,14 @@ module BigMarkerClient
|
|
24
24
|
result
|
25
25
|
end
|
26
26
|
|
27
|
+
##
|
28
|
+
# helper method to retrieve all pages for the #list method
|
29
|
+
# @see #list
|
30
|
+
def list_all(conference_id, params = {})
|
31
|
+
path = replace_path_params(path: LIST_REGISTRANTS, replacements: { "{id}": conference_id })
|
32
|
+
loop_over(path, "registrations", ::BigMarkerClient::Models::Registrant, params)
|
33
|
+
end
|
34
|
+
|
27
35
|
##
|
28
36
|
# list all registrants to a conference with custom fields.
|
29
37
|
# @param conference_id [String] conference identifier
|
@@ -39,6 +47,14 @@ module BigMarkerClient
|
|
39
47
|
result
|
40
48
|
end
|
41
49
|
|
50
|
+
##
|
51
|
+
# helper method to retrieve all pages for the #list_with_fields method
|
52
|
+
# @see #list_with_fields
|
53
|
+
def list_all_with_fields(conference_id, params = {})
|
54
|
+
path = replace_path_params(path: LIST_REGISTRANTS_WITH_FIELDS, replacements: { "{id}": conference_id })
|
55
|
+
loop_over(path, "registrations", ::BigMarkerClient::Models::Registrant, params)
|
56
|
+
end
|
57
|
+
|
42
58
|
##
|
43
59
|
# registers a participant to a conference.
|
44
60
|
# @param conference_id [String] conference identifier
|
@@ -86,8 +102,8 @@ module BigMarkerClient
|
|
86
102
|
|
87
103
|
private
|
88
104
|
|
89
|
-
def map_to_model_array(hash_array)
|
90
|
-
hash_array.map { |hash|
|
105
|
+
def map_to_model_array(hash_array, model_class = ::BigMarkerClient::Models::Registrant)
|
106
|
+
hash_array.map { |hash| model_class.new(hash) }
|
91
107
|
end
|
92
108
|
end
|
93
109
|
end
|
@@ -34,6 +34,14 @@ module BigMarkerClient
|
|
34
34
|
result
|
35
35
|
end
|
36
36
|
|
37
|
+
##
|
38
|
+
# helper method to retrieve all pages for the #list method
|
39
|
+
# @see #list
|
40
|
+
def list_all(params = {})
|
41
|
+
params["page_count"] ||= params["per_page"] if params["per_page"]
|
42
|
+
loop_over(LIST_CONFERENCES, "conferences", ::BigMarkerClient::Models::Conference, params)
|
43
|
+
end
|
44
|
+
|
37
45
|
##
|
38
46
|
# search for conferences with specific matching criteria.
|
39
47
|
# @param params [Hash] recognized are:
|
@@ -55,6 +63,13 @@ module BigMarkerClient
|
|
55
63
|
result
|
56
64
|
end
|
57
65
|
|
66
|
+
##
|
67
|
+
# helper method to retrieve all pages for the #search method
|
68
|
+
# @see #search
|
69
|
+
def search_all(params = {})
|
70
|
+
loop_over(SEARCH_CONFERENCES, "conferences", ::BigMarkerClient::Models::Conference, params, :post)
|
71
|
+
end
|
72
|
+
|
58
73
|
##
|
59
74
|
# get one conference based on it's ID
|
60
75
|
# @param conference_id [String] conference identifier
|
@@ -81,6 +96,14 @@ module BigMarkerClient
|
|
81
96
|
result
|
82
97
|
end
|
83
98
|
|
99
|
+
##
|
100
|
+
# helper method to retrieve all pages for the #associated_series method
|
101
|
+
# @see #associated_series
|
102
|
+
def associated_series_all(conference_id, params = {})
|
103
|
+
path = replace_path_params(path: ASSOCIATED_SERIES_CONFERENCES, replacements: { "{id}": conference_id })
|
104
|
+
loop_over(path, "conferences", ::BigMarkerClient::Models::Conference, params)
|
105
|
+
end
|
106
|
+
|
84
107
|
##
|
85
108
|
# get child conferences of a parent recurring conference.
|
86
109
|
# @param conference_id [String] conference identifier
|
@@ -98,6 +121,14 @@ module BigMarkerClient
|
|
98
121
|
result
|
99
122
|
end
|
100
123
|
|
124
|
+
##
|
125
|
+
# helper method to retrieve all pages for the #recurring method
|
126
|
+
# @see #recurring
|
127
|
+
def recurring_all(conference_id, params = {})
|
128
|
+
path = replace_path_params(path: RECURRING_CONFERENCES, replacements: { "{id}": conference_id })
|
129
|
+
loop_over(path, "conferences", ::BigMarkerClient::Models::Conference, params)
|
130
|
+
end
|
131
|
+
|
101
132
|
##
|
102
133
|
# update a conference either with a Models::Conference object or single properties as hash
|
103
134
|
# @param conference_id [String] conference identifier
|
@@ -176,6 +207,14 @@ module BigMarkerClient
|
|
176
207
|
result
|
177
208
|
end
|
178
209
|
|
210
|
+
##
|
211
|
+
# helper method to retrieve all pages for the #attendees method
|
212
|
+
# @see #attendees
|
213
|
+
def attendees_all(conference_id, params = {})
|
214
|
+
path = replace_path_params(path: GET_CONFERENCE_ATTENDEES, replacements: { "{id}": conference_id })
|
215
|
+
loop_over(path, "attendees", ::BigMarkerClient::Models::Attendee, params)
|
216
|
+
end
|
217
|
+
|
179
218
|
private
|
180
219
|
|
181
220
|
def map_to_model_array(hash_array, model_class = ::BigMarkerClient::Models::Conference)
|
@@ -32,6 +32,20 @@ module BigMarkerClient
|
|
32
32
|
new_path
|
33
33
|
end
|
34
34
|
|
35
|
+
def loop_over(path, field, model_class, params = {}, method = :get)
|
36
|
+
page = 1
|
37
|
+
results = []
|
38
|
+
loop do
|
39
|
+
params[:page] = page
|
40
|
+
result = send(method, path, params)
|
41
|
+
results += map_to_model_array(result[field], model_class) if result[field]
|
42
|
+
break if page >= result["total_pages"].to_i || results.length >= total_count(result).to_i
|
43
|
+
|
44
|
+
page += 1
|
45
|
+
end
|
46
|
+
results
|
47
|
+
end
|
48
|
+
|
35
49
|
private
|
36
50
|
|
37
51
|
def request(path:, verb: :get, params: {})
|
@@ -86,6 +100,13 @@ module BigMarkerClient
|
|
86
100
|
rescue JSON::ParserError
|
87
101
|
raise BigMarkerClient::ResponseError, "invalid response"
|
88
102
|
end
|
103
|
+
|
104
|
+
##
|
105
|
+
# conferences#list is a total mess as requests require `page_count` instead of `per_page` as everywhere else and
|
106
|
+
# ti will return `total_count` instead of `total_entries` compared to the rest
|
107
|
+
def total_count(response)
|
108
|
+
response["total_entries"] || response["total_count"]
|
109
|
+
end
|
89
110
|
end
|
90
111
|
end
|
91
112
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: big_marker_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Burkhard Vogel-Kreykenbohm
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|