kentaa-api 0.2.0 → 0.4.0
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 +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +14 -3
- data/.travis.yml +5 -4
- data/Gemfile +3 -2
- data/Gemfile.lock +19 -14
- data/README.md +12 -12
- data/kentaa-api.gemspec +2 -2
- data/lib/kentaa/api.rb +6 -4
- data/lib/kentaa/api/client.rb +4 -0
- data/lib/kentaa/api/clients/actions.rb +19 -6
- data/lib/kentaa/api/clients/base.rb +0 -4
- 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/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 +19 -6
- data/lib/kentaa/api/exception.rb +18 -0
- data/lib/kentaa/api/finder.rb +9 -0
- data/lib/kentaa/api/request.rb +46 -5
- data/lib/kentaa/api/resources/action.rb +36 -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 +25 -18
- 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 +112 -0
- data/lib/kentaa/api/resources/manual_donations.rb +40 -0
- data/lib/kentaa/api/resources/newsletter_subscription.rb +12 -11
- 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 +26 -12
- data/lib/kentaa/api/resources/projects.rb +6 -3
- data/lib/kentaa/api/resources/question.rb +10 -2
- 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 +16 -4
- data/lib/kentaa/api/resources/segments.rb +6 -3
- data/lib/kentaa/api/resources/site.rb +16 -4
- data/lib/kentaa/api/resources/team.rb +23 -14
- data/lib/kentaa/api/resources/teams.rb +6 -3
- data/lib/kentaa/api/resources/user.rb +17 -5
- data/lib/kentaa/api/resources/users.rb +11 -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 +16 -14
- data/lib/kentaa/api/clients/all.rb +0 -26
- data/lib/kentaa/api/resources/status.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ebca7b73a3ae49b7d9948211b21638e7131340fe58f6b34551260853dd4b6fb
|
4
|
+
data.tar.gz: cc9a8b5450c1b4068867a2bf0eada220174e3d107ae2369ddbc5080bcf785257
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2815897919718da19a9ed6ddb05589523b492639427fced920168bb469c794a83c5cc4477f9dc3403e7a932f6d88d657035a741f5cb3a44c075807b88b3ccf0f
|
7
|
+
data.tar.gz: 696d64f0bf684fafcbf1c38c24f3f1b03c97312f2c6b666054464b85b58b0907eb27e8a42bffd4e886d035475daaab8e22354af9a39ce9ea9a54943fbd225962
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
# Kentaa-API RuboCop configuration
|
2
2
|
|
3
|
-
require:
|
3
|
+
require:
|
4
|
+
- rubocop-performance
|
5
|
+
- rubocop-rspec
|
4
6
|
|
5
7
|
AllCops:
|
6
8
|
TargetRubyVersion: 2.3
|
7
9
|
DisplayCopNames: true
|
8
10
|
DisplayStyleGuide: true
|
9
11
|
|
10
|
-
|
12
|
+
Layout/LineLength:
|
11
13
|
Enabled: false
|
12
14
|
|
13
15
|
Metrics/AbcSize:
|
@@ -19,7 +21,7 @@ Metrics/BlockLength:
|
|
19
21
|
Metrics/ClassLength:
|
20
22
|
Enabled: false
|
21
23
|
|
22
|
-
Metrics/
|
24
|
+
Metrics/CyclomaticComplexity:
|
23
25
|
Enabled: false
|
24
26
|
|
25
27
|
Metrics/MethodLength:
|
@@ -40,6 +42,15 @@ Style/Documentation:
|
|
40
42
|
Style/ExpandPathArguments:
|
41
43
|
Enabled: false
|
42
44
|
|
45
|
+
Style/HashEachMethods:
|
46
|
+
Enabled: true
|
47
|
+
|
48
|
+
Style/HashTransformKeys:
|
49
|
+
Enabled: true
|
50
|
+
|
51
|
+
Style/HashTransformValues:
|
52
|
+
Enabled: true
|
53
|
+
|
43
54
|
Style/IfUnlessModifier:
|
44
55
|
Enabled: false
|
45
56
|
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -5,5 +5,6 @@ source 'https://rubygems.org'
|
|
5
5
|
# Specify your gem's dependencies in kentaa-api.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem 'rubocop', '~> 0.
|
9
|
-
gem 'rubocop-
|
8
|
+
gem 'rubocop', '~> 0.80.1'
|
9
|
+
gem 'rubocop-performance', '~> 1.5.2'
|
10
|
+
gem 'rubocop-rspec', '~> 1.38.1'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
kentaa-api (0.
|
4
|
+
kentaa-api (0.4.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -13,13 +13,14 @@ GEM
|
|
13
13
|
safe_yaml (~> 1.0.0)
|
14
14
|
diff-lcs (1.3)
|
15
15
|
hashdiff (0.3.7)
|
16
|
-
jaro_winkler (1.5.
|
17
|
-
parallel (1.
|
18
|
-
parser (2.
|
16
|
+
jaro_winkler (1.5.4)
|
17
|
+
parallel (1.19.1)
|
18
|
+
parser (2.7.0.4)
|
19
19
|
ast (~> 2.4.0)
|
20
20
|
public_suffix (3.0.3)
|
21
21
|
rainbow (3.0.0)
|
22
|
-
rake (
|
22
|
+
rake (12.3.3)
|
23
|
+
rexml (3.2.4)
|
23
24
|
rspec (3.8.0)
|
24
25
|
rspec-core (~> 3.8.0)
|
25
26
|
rspec-expectations (~> 3.8.0)
|
@@ -33,18 +34,21 @@ GEM
|
|
33
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
34
35
|
rspec-support (~> 3.8.0)
|
35
36
|
rspec-support (3.8.0)
|
36
|
-
rubocop (0.
|
37
|
+
rubocop (0.80.1)
|
37
38
|
jaro_winkler (~> 1.5.1)
|
38
39
|
parallel (~> 1.10)
|
39
|
-
parser (>= 2.
|
40
|
+
parser (>= 2.7.0.1)
|
40
41
|
rainbow (>= 2.2.2, < 4.0)
|
42
|
+
rexml
|
41
43
|
ruby-progressbar (~> 1.7)
|
42
44
|
unicode-display_width (>= 1.4.0, < 1.7)
|
43
|
-
rubocop-
|
44
|
-
rubocop (>= 0.
|
45
|
+
rubocop-performance (1.5.2)
|
46
|
+
rubocop (>= 0.71.0)
|
47
|
+
rubocop-rspec (1.38.1)
|
48
|
+
rubocop (>= 0.68.1)
|
45
49
|
ruby-progressbar (1.10.1)
|
46
50
|
safe_yaml (1.0.4)
|
47
|
-
unicode-display_width (1.6.
|
51
|
+
unicode-display_width (1.6.1)
|
48
52
|
webmock (2.3.2)
|
49
53
|
addressable (>= 2.3.6)
|
50
54
|
crack (>= 0.3.2)
|
@@ -56,11 +60,12 @@ PLATFORMS
|
|
56
60
|
DEPENDENCIES
|
57
61
|
bundler (~> 1.14)
|
58
62
|
kentaa-api!
|
59
|
-
rake (~>
|
63
|
+
rake (~> 12.3)
|
60
64
|
rspec (~> 3.0)
|
61
|
-
rubocop (~> 0.
|
62
|
-
rubocop-
|
65
|
+
rubocop (~> 0.80.1)
|
66
|
+
rubocop-performance (~> 1.5.2)
|
67
|
+
rubocop-rspec (~> 1.38.1)
|
63
68
|
webmock (~> 2.3, >= 2.3.2)
|
64
69
|
|
65
70
|
BUNDLED WITH
|
66
|
-
1.17.
|
71
|
+
1.17.3
|
data/README.md
CHANGED
@@ -37,7 +37,7 @@ client = Kentaa::Api::Client.new(config)
|
|
37
37
|
|
38
38
|
### Retrieving data
|
39
39
|
|
40
|
-
All endpoints use the same convention for retrieving data. The
|
40
|
+
All endpoints use the same convention for retrieving data. The method `list` is for retrieving multiple resources. The method `get` is used for retrieving a single resource.
|
41
41
|
|
42
42
|
The `list` method on the endpoint returns an [Enumerable](https://ruby-doc.org/core/Enumerable.html) object:
|
43
43
|
|
@@ -51,10 +51,10 @@ actions.first
|
|
51
51
|
The results might be part of a paginated set. You can query the next page by doing:
|
52
52
|
|
53
53
|
```ruby
|
54
|
-
actions =
|
54
|
+
actions = actions.next if actions.next_page?
|
55
55
|
```
|
56
56
|
|
57
|
-
See also `Kentaa::Api::Resources::
|
57
|
+
See also `Kentaa::Api::Resources::List` for the available methods for pagination.
|
58
58
|
|
59
59
|
The `all` method on the endpoint returns an [Enumerator](https://ruby-doc.org/core/Enumerator.html) and will iterate automatically through all pages to retrieve the requested data.
|
60
60
|
|
@@ -84,10 +84,10 @@ See also the [Kentaa API docs](https://api.kentaa.nl/v1/doc/actions).
|
|
84
84
|
#### Donations
|
85
85
|
|
86
86
|
```ruby
|
87
|
-
donations = client.donations.list
|
88
|
-
donations = client.donations.all
|
87
|
+
donations = client.donations.list # get donations (paginated)
|
88
|
+
donations = client.donations.all # get all donations (non-paginated)
|
89
89
|
|
90
|
-
donation = client.donations.get(1)
|
90
|
+
donation = client.donations.get(1) # query donation by ID
|
91
91
|
```
|
92
92
|
|
93
93
|
See also the [Kentaa API docs](https://api.kentaa.nl/v1/doc/donations).
|
@@ -95,11 +95,11 @@ See also the [Kentaa API docs](https://api.kentaa.nl/v1/doc/donations).
|
|
95
95
|
#### Newsletter subscriptions
|
96
96
|
|
97
97
|
```ruby
|
98
|
-
newsletter_subscriptions = client.newsletter_subscriptions.
|
99
|
-
newsletter_subscriptions = client.newsletter_subscriptions.
|
98
|
+
newsletter_subscriptions = client.newsletter_subscriptions.list # get newsletter subscriptions (paginated)
|
99
|
+
newsletter_subscriptions = client.newsletter_subscriptions.all # get all newsletter subscriptions (non-paginated)
|
100
100
|
|
101
101
|
|
102
|
-
newsletter_subscriptions = client.newsletter_subscriptions.get(1)
|
102
|
+
newsletter_subscriptions = client.newsletter_subscriptions.get(1) # query newsletter subscription by ID
|
103
103
|
```
|
104
104
|
|
105
105
|
See also the [Kentaa API docs](https://api.kentaa.nl/v1/doc/newsletter-subscriptions).
|
@@ -119,10 +119,10 @@ See also the [Kentaa API docs](https://api.kentaa.nl/v1/doc/projects).
|
|
119
119
|
#### Segments
|
120
120
|
|
121
121
|
```ruby
|
122
|
-
segments = client.segments.list
|
123
|
-
segments = client.segments.all
|
122
|
+
segments = client.segments.list # get segments (paginated)
|
123
|
+
segments = client.segments.all # get all segments (non-paginated)
|
124
124
|
|
125
|
-
segment = client.segments.get(1)
|
125
|
+
segment = client.segments.get(1) # query segment by ID
|
126
126
|
```
|
127
127
|
|
128
128
|
See also the [Kentaa API docs](https://api.kentaa.nl/v1/doc/segments).
|
data/kentaa-api.gemspec
CHANGED
@@ -21,10 +21,10 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.required_ruby_version = ">= 2.
|
24
|
+
spec.required_ruby_version = ">= 2.3.0"
|
25
25
|
|
26
26
|
spec.add_development_dependency "bundler", "~> 1.14"
|
27
|
-
spec.add_development_dependency "rake", "~>
|
27
|
+
spec.add_development_dependency "rake", "~> 12.3"
|
28
28
|
spec.add_development_dependency "rspec", "~> 3.0"
|
29
29
|
spec.add_development_dependency "webmock", "~> 2.3", ">= 2.3.2"
|
30
30
|
end
|
data/lib/kentaa/api.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "api/clients/base"
|
4
|
-
require_relative "api/clients/all"
|
5
|
-
|
6
4
|
require_relative "api/clients/actions"
|
7
5
|
require_relative "api/clients/donations"
|
6
|
+
require_relative "api/clients/manual_donations"
|
8
7
|
require_relative "api/clients/newsletter_subscriptions"
|
9
8
|
require_relative "api/clients/projects"
|
10
9
|
require_relative "api/clients/segments"
|
@@ -13,9 +12,9 @@ require_relative "api/clients/teams"
|
|
13
12
|
require_relative "api/clients/users"
|
14
13
|
|
15
14
|
require_relative "api/resources/base"
|
16
|
-
require_relative "api/resources/
|
15
|
+
require_relative "api/resources/error"
|
16
|
+
require_relative "api/resources/list"
|
17
17
|
require_relative "api/resources/resource"
|
18
|
-
require_relative "api/resources/status"
|
19
18
|
|
20
19
|
require_relative "api/resources/action"
|
21
20
|
require_relative "api/resources/actions"
|
@@ -23,9 +22,12 @@ require_relative "api/resources/activity"
|
|
23
22
|
require_relative "api/resources/address"
|
24
23
|
require_relative "api/resources/banner"
|
25
24
|
require_relative "api/resources/consent"
|
25
|
+
require_relative "api/resources/contact"
|
26
26
|
require_relative "api/resources/donation"
|
27
27
|
require_relative "api/resources/donations"
|
28
28
|
require_relative "api/resources/location"
|
29
|
+
require_relative "api/resources/manual_donation"
|
30
|
+
require_relative "api/resources/manual_donations"
|
29
31
|
require_relative "api/resources/newsletter_subscription"
|
30
32
|
require_relative "api/resources/newsletter_subscriptions"
|
31
33
|
require_relative "api/resources/photo"
|
data/lib/kentaa/api/client.rb
CHANGED
@@ -15,6 +15,10 @@ module Kentaa
|
|
15
15
|
Kentaa::Api::Clients::Donations.new(@config)
|
16
16
|
end
|
17
17
|
|
18
|
+
def manual_donations
|
19
|
+
Kentaa::Api::Clients::ManualDonations.new(@config)
|
20
|
+
end
|
21
|
+
|
18
22
|
def newsletter_subscriptions
|
19
23
|
Kentaa::Api::Clients::NewsletterSubscriptions.new(@config)
|
20
24
|
end
|
@@ -4,16 +4,29 @@ module Kentaa
|
|
4
4
|
module Api
|
5
5
|
module Clients
|
6
6
|
class Actions < Base
|
7
|
-
|
7
|
+
def all(options = {})
|
8
|
+
actions = Kentaa::Api::Resources::Actions.new(config, options)
|
9
|
+
actions.all
|
10
|
+
end
|
8
11
|
|
9
12
|
def list(options = {})
|
10
|
-
|
11
|
-
|
13
|
+
actions = Kentaa::Api::Resources::Actions.new(config, options)
|
14
|
+
actions.load
|
15
|
+
end
|
16
|
+
|
17
|
+
def get(id, options = {})
|
18
|
+
action = Kentaa::Api::Resources::Action.new(config, options.merge(id: id))
|
19
|
+
action.load
|
20
|
+
end
|
21
|
+
|
22
|
+
def create(attributes = {}, options = {})
|
23
|
+
action = Kentaa::Api::Resources::Actions.new(config, options)
|
24
|
+
action.create(attributes)
|
12
25
|
end
|
13
26
|
|
14
|
-
def
|
15
|
-
|
16
|
-
|
27
|
+
def update(id, attributes = {}, options = {})
|
28
|
+
action = Kentaa::Api::Resources::Action.new(config, options.merge(id: id))
|
29
|
+
action.save(attributes)
|
17
30
|
end
|
18
31
|
end
|
19
32
|
end
|
@@ -4,16 +4,19 @@ module Kentaa
|
|
4
4
|
module Api
|
5
5
|
module Clients
|
6
6
|
class Donations < Base
|
7
|
-
|
7
|
+
def all(options = {})
|
8
|
+
donations = Kentaa::Api::Resources::Donations.new(config, options)
|
9
|
+
donations.all
|
10
|
+
end
|
8
11
|
|
9
12
|
def list(options = {})
|
10
|
-
|
11
|
-
|
13
|
+
donations = Kentaa::Api::Resources::Donations.new(config, options)
|
14
|
+
donations.load
|
12
15
|
end
|
13
16
|
|
14
|
-
def get(id)
|
15
|
-
|
16
|
-
|
17
|
+
def get(id, options = {})
|
18
|
+
donation = Kentaa::Api::Resources::Donation.new(config, options.merge(id: id))
|
19
|
+
donation.load
|
17
20
|
end
|
18
21
|
end
|
19
22
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kentaa
|
4
|
+
module Api
|
5
|
+
module Clients
|
6
|
+
class ManualDonations < Base
|
7
|
+
def all(options = {})
|
8
|
+
donations = Kentaa::Api::Resources::ManualDonations.new(config, options)
|
9
|
+
donations.all
|
10
|
+
end
|
11
|
+
|
12
|
+
def list(options = {})
|
13
|
+
donations = Kentaa::Api::Resources::ManualDonations.new(config, options)
|
14
|
+
donations.load
|
15
|
+
end
|
16
|
+
|
17
|
+
def get(id, options = {})
|
18
|
+
donation = Kentaa::Api::Resources::ManualDonation.new(config, options.merge(id: id))
|
19
|
+
donation.load
|
20
|
+
end
|
21
|
+
|
22
|
+
def create(attributes = {}, options = {})
|
23
|
+
donation = Kentaa::Api::Resources::ManualDonation.new(config, options)
|
24
|
+
donation.save(attributes)
|
25
|
+
end
|
26
|
+
|
27
|
+
def update(id, attributes = {}, options = {})
|
28
|
+
donation = Kentaa::Api::Resources::ManualDonation.new(config, options.merge(id: id))
|
29
|
+
donation.save(attributes)
|
30
|
+
end
|
31
|
+
|
32
|
+
def delete(id, options = {})
|
33
|
+
donation = Kentaa::Api::Resources::ManualDonation.new(config, options.merge(id: id))
|
34
|
+
donation.delete
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -4,16 +4,19 @@ module Kentaa
|
|
4
4
|
module Api
|
5
5
|
module Clients
|
6
6
|
class NewsletterSubscriptions < Base
|
7
|
-
|
7
|
+
def all(options = {})
|
8
|
+
newsletter_subscriptions = Kentaa::Api::Resources::NewsletterSubscriptions.new(config, options)
|
9
|
+
newsletter_subscriptions.all
|
10
|
+
end
|
8
11
|
|
9
12
|
def list(options = {})
|
10
|
-
|
11
|
-
|
13
|
+
newsletter_subscriptions = Kentaa::Api::Resources::NewsletterSubscriptions.new(config, options)
|
14
|
+
newsletter_subscriptions.load
|
12
15
|
end
|
13
16
|
|
14
|
-
def get(id)
|
15
|
-
|
16
|
-
|
17
|
+
def get(id, options = {})
|
18
|
+
newsletter_subscription = Kentaa::Api::Resources::NewsletterSubscription.new(config, options.merge(id: id))
|
19
|
+
newsletter_subscription.load
|
17
20
|
end
|
18
21
|
end
|
19
22
|
end
|
@@ -4,16 +4,19 @@ module Kentaa
|
|
4
4
|
module Api
|
5
5
|
module Clients
|
6
6
|
class Projects < Base
|
7
|
-
|
7
|
+
def all(options = {})
|
8
|
+
projects = Kentaa::Api::Resources::Projects.new(config, options)
|
9
|
+
projects.all
|
10
|
+
end
|
8
11
|
|
9
12
|
def list(options = {})
|
10
|
-
|
11
|
-
|
13
|
+
projects = Kentaa::Api::Resources::Projects.new(config, options)
|
14
|
+
projects.load
|
12
15
|
end
|
13
16
|
|
14
|
-
def get(id)
|
15
|
-
|
16
|
-
|
17
|
+
def get(id, options = {})
|
18
|
+
project = Kentaa::Api::Resources::Project.new(config, options.merge(id: id))
|
19
|
+
project.load
|
17
20
|
end
|
18
21
|
end
|
19
22
|
end
|