kentaa-api 0.2.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +22 -4
- data/.travis.yml +5 -5
- data/Gemfile +4 -2
- data/Gemfile.lock +33 -20
- data/README.md +320 -66
- data/kentaa-api.gemspec +3 -3
- data/lib/kentaa/api.rb +12 -4
- data/lib/kentaa/api/client.rb +12 -0
- data/lib/kentaa/api/clients/actions.rb +19 -6
- data/lib/kentaa/api/clients/base.rb +0 -4
- data/lib/kentaa/api/clients/donation_forms.rb +24 -0
- data/lib/kentaa/api/clients/donations.rb +9 -6
- data/lib/kentaa/api/clients/manual_donations.rb +39 -0
- data/lib/kentaa/api/clients/newsletter_subscriptions.rb +9 -6
- data/lib/kentaa/api/clients/projects.rb +9 -6
- data/lib/kentaa/api/clients/recurring_donors.rb +24 -0
- data/lib/kentaa/api/clients/segments.rb +9 -6
- data/lib/kentaa/api/clients/sites.rb +3 -3
- data/lib/kentaa/api/clients/teams.rb +9 -6
- data/lib/kentaa/api/clients/users.rb +24 -6
- data/lib/kentaa/api/config.rb +4 -0
- data/lib/kentaa/api/exception.rb +21 -0
- data/lib/kentaa/api/finder.rb +9 -0
- data/lib/kentaa/api/request.rb +55 -5
- data/lib/kentaa/api/resources/action.rb +40 -20
- data/lib/kentaa/api/resources/actions.rb +11 -3
- data/lib/kentaa/api/resources/activity.rb +10 -2
- data/lib/kentaa/api/resources/address.rb +6 -2
- data/lib/kentaa/api/resources/banner.rb +20 -2
- data/lib/kentaa/api/resources/base.rb +35 -11
- data/lib/kentaa/api/resources/consent.rb +7 -1
- data/lib/kentaa/api/resources/contact.rb +83 -0
- data/lib/kentaa/api/resources/donation.rb +35 -18
- data/lib/kentaa/api/resources/donation_form.rb +100 -0
- data/lib/kentaa/api/resources/donation_forms.rb +35 -0
- data/lib/kentaa/api/resources/donations.rb +6 -3
- data/lib/kentaa/api/resources/error.rb +23 -0
- data/lib/kentaa/api/resources/{pagination.rb → list.rb} +26 -3
- data/lib/kentaa/api/resources/location.rb +7 -1
- data/lib/kentaa/api/resources/manual_donation.rb +122 -0
- data/lib/kentaa/api/resources/manual_donations.rb +40 -0
- data/lib/kentaa/api/resources/newsletter_subscription.rb +21 -10
- data/lib/kentaa/api/resources/newsletter_subscriptions.rb +6 -3
- data/lib/kentaa/api/resources/photo.rb +20 -2
- data/lib/kentaa/api/resources/project.rb +34 -12
- data/lib/kentaa/api/resources/projects.rb +6 -3
- data/lib/kentaa/api/resources/question.rb +18 -2
- data/lib/kentaa/api/resources/recurring_donor.rb +110 -0
- data/lib/kentaa/api/resources/recurring_donors.rb +35 -0
- data/lib/kentaa/api/resources/registration_fee.rb +1 -1
- data/lib/kentaa/api/resources/resource.rb +50 -3
- data/lib/kentaa/api/resources/reward.rb +10 -2
- data/lib/kentaa/api/resources/segment.rb +28 -4
- data/lib/kentaa/api/resources/segments.rb +6 -3
- data/lib/kentaa/api/resources/site.rb +20 -4
- data/lib/kentaa/api/resources/team.rb +27 -14
- data/lib/kentaa/api/resources/teams.rb +6 -3
- data/lib/kentaa/api/resources/user.rb +27 -5
- data/lib/kentaa/api/resources/users.rb +16 -3
- data/lib/kentaa/api/resources/video.rb +20 -2
- data/lib/kentaa/api/response.rb +21 -3
- data/lib/kentaa/api/version.rb +1 -1
- metadata +24 -16
- data/lib/kentaa/api/clients/all.rb +0 -26
- data/lib/kentaa/api/resources/status.rb +0 -27
@@ -1,10 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'time'
|
4
|
+
|
3
5
|
module Kentaa
|
4
6
|
module Api
|
5
7
|
module Resources
|
6
|
-
class Video
|
7
|
-
|
8
|
+
class Video
|
9
|
+
attr_reader :data
|
10
|
+
|
11
|
+
def initialize(data)
|
12
|
+
@data = data
|
13
|
+
end
|
14
|
+
|
15
|
+
def id
|
16
|
+
data[:id]
|
17
|
+
end
|
18
|
+
|
19
|
+
def created_at
|
20
|
+
Time.parse(data[:created_at]) if data[:created_at]
|
21
|
+
end
|
22
|
+
|
23
|
+
def updated_at
|
24
|
+
Time.parse(data[:updated_at]) if data[:updated_at]
|
25
|
+
end
|
8
26
|
|
9
27
|
def url
|
10
28
|
data[:url]
|
data/lib/kentaa/api/response.rb
CHANGED
@@ -9,25 +9,43 @@ module Kentaa
|
|
9
9
|
|
10
10
|
def initialize(response)
|
11
11
|
@response = response
|
12
|
-
@body = parse_body(response.body)
|
12
|
+
@body = response.body ? parse_body(response.body) : {}
|
13
13
|
end
|
14
14
|
|
15
15
|
def success?
|
16
|
-
(
|
16
|
+
(http_code == 200 || http_code == 201 || http_code == 204) && !message
|
17
17
|
end
|
18
18
|
|
19
19
|
def error?
|
20
20
|
!success?
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
23
|
+
def http_code
|
24
24
|
response.code.to_i
|
25
25
|
end
|
26
26
|
|
27
|
+
def request_uri
|
28
|
+
response.uri
|
29
|
+
end
|
30
|
+
|
27
31
|
def message
|
28
32
|
body[:message]
|
29
33
|
end
|
30
34
|
|
35
|
+
def errors
|
36
|
+
@errors ||= begin
|
37
|
+
errors = []
|
38
|
+
|
39
|
+
if body[:errors]
|
40
|
+
body[:errors].each do |error|
|
41
|
+
errors << Kentaa::Api::Resources::Error.new(error)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
errors
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
31
49
|
private
|
32
50
|
|
33
51
|
def parse_body(body)
|
data/lib/kentaa/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kentaa-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kentaa
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,7 +72,7 @@ dependencies:
|
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 2.3.2
|
75
|
-
description:
|
75
|
+
description:
|
76
76
|
email:
|
77
77
|
- support@kentaa.nl
|
78
78
|
executables: []
|
@@ -94,11 +94,13 @@ files:
|
|
94
94
|
- lib/kentaa/api.rb
|
95
95
|
- lib/kentaa/api/client.rb
|
96
96
|
- lib/kentaa/api/clients/actions.rb
|
97
|
-
- lib/kentaa/api/clients/all.rb
|
98
97
|
- lib/kentaa/api/clients/base.rb
|
98
|
+
- lib/kentaa/api/clients/donation_forms.rb
|
99
99
|
- lib/kentaa/api/clients/donations.rb
|
100
|
+
- lib/kentaa/api/clients/manual_donations.rb
|
100
101
|
- lib/kentaa/api/clients/newsletter_subscriptions.rb
|
101
102
|
- lib/kentaa/api/clients/projects.rb
|
103
|
+
- lib/kentaa/api/clients/recurring_donors.rb
|
102
104
|
- lib/kentaa/api/clients/segments.rb
|
103
105
|
- lib/kentaa/api/clients/sites.rb
|
104
106
|
- lib/kentaa/api/clients/teams.rb
|
@@ -114,23 +116,30 @@ files:
|
|
114
116
|
- lib/kentaa/api/resources/banner.rb
|
115
117
|
- lib/kentaa/api/resources/base.rb
|
116
118
|
- lib/kentaa/api/resources/consent.rb
|
119
|
+
- lib/kentaa/api/resources/contact.rb
|
117
120
|
- lib/kentaa/api/resources/donation.rb
|
121
|
+
- lib/kentaa/api/resources/donation_form.rb
|
122
|
+
- lib/kentaa/api/resources/donation_forms.rb
|
118
123
|
- lib/kentaa/api/resources/donations.rb
|
124
|
+
- lib/kentaa/api/resources/error.rb
|
125
|
+
- lib/kentaa/api/resources/list.rb
|
119
126
|
- lib/kentaa/api/resources/location.rb
|
127
|
+
- lib/kentaa/api/resources/manual_donation.rb
|
128
|
+
- lib/kentaa/api/resources/manual_donations.rb
|
120
129
|
- lib/kentaa/api/resources/newsletter_subscription.rb
|
121
130
|
- lib/kentaa/api/resources/newsletter_subscriptions.rb
|
122
|
-
- lib/kentaa/api/resources/pagination.rb
|
123
131
|
- lib/kentaa/api/resources/photo.rb
|
124
132
|
- lib/kentaa/api/resources/project.rb
|
125
133
|
- lib/kentaa/api/resources/projects.rb
|
126
134
|
- lib/kentaa/api/resources/question.rb
|
135
|
+
- lib/kentaa/api/resources/recurring_donor.rb
|
136
|
+
- lib/kentaa/api/resources/recurring_donors.rb
|
127
137
|
- lib/kentaa/api/resources/registration_fee.rb
|
128
138
|
- lib/kentaa/api/resources/resource.rb
|
129
139
|
- lib/kentaa/api/resources/reward.rb
|
130
140
|
- lib/kentaa/api/resources/segment.rb
|
131
141
|
- lib/kentaa/api/resources/segments.rb
|
132
142
|
- lib/kentaa/api/resources/site.rb
|
133
|
-
- lib/kentaa/api/resources/status.rb
|
134
143
|
- lib/kentaa/api/resources/team.rb
|
135
144
|
- lib/kentaa/api/resources/teams.rb
|
136
145
|
- lib/kentaa/api/resources/user.rb
|
@@ -142,7 +151,7 @@ homepage: https://github.com/KentaaNL/kentaa-api
|
|
142
151
|
licenses:
|
143
152
|
- MIT
|
144
153
|
metadata: {}
|
145
|
-
post_install_message:
|
154
|
+
post_install_message:
|
146
155
|
rdoc_options: []
|
147
156
|
require_paths:
|
148
157
|
- lib
|
@@ -150,16 +159,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
150
159
|
requirements:
|
151
160
|
- - ">="
|
152
161
|
- !ruby/object:Gem::Version
|
153
|
-
version: 2.
|
162
|
+
version: 2.4.0
|
154
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
164
|
requirements:
|
156
165
|
- - ">="
|
157
166
|
- !ruby/object:Gem::Version
|
158
167
|
version: '0'
|
159
168
|
requirements: []
|
160
|
-
|
161
|
-
|
162
|
-
signing_key:
|
169
|
+
rubygems_version: 3.2.3
|
170
|
+
signing_key:
|
163
171
|
specification_version: 4
|
164
172
|
summary: Ruby library for communicating with the Kentaa API
|
165
173
|
test_files: []
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kentaa
|
4
|
-
module Api
|
5
|
-
module Clients
|
6
|
-
module All
|
7
|
-
def all(options = {})
|
8
|
-
enumerator = Enumerator.new do |yielder|
|
9
|
-
page = 1
|
10
|
-
|
11
|
-
loop do
|
12
|
-
response = list(options.merge(page: page))
|
13
|
-
response.each { |item| yielder.yield item } if response.success?
|
14
|
-
|
15
|
-
raise StopIteration unless response.next_page?
|
16
|
-
|
17
|
-
page = response.next_page
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
enumerator.lazy
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kentaa
|
4
|
-
module Api
|
5
|
-
module Resources
|
6
|
-
module Status
|
7
|
-
attr_accessor :response
|
8
|
-
|
9
|
-
def success?
|
10
|
-
response.success?
|
11
|
-
end
|
12
|
-
|
13
|
-
def error?
|
14
|
-
response.error?
|
15
|
-
end
|
16
|
-
|
17
|
-
def body
|
18
|
-
response.body
|
19
|
-
end
|
20
|
-
|
21
|
-
def message
|
22
|
-
response.message
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|