kentaa-api 0.3.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +23 -0
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +21 -5
  5. data/Gemfile +4 -2
  6. data/Gemfile.lock +45 -32
  7. data/README.md +364 -67
  8. data/kentaa-api.gemspec +3 -3
  9. data/lib/kentaa/api.rb +9 -20
  10. data/lib/kentaa/api/client.rb +30 -18
  11. data/lib/kentaa/api/config.rb +10 -3
  12. data/lib/kentaa/api/exception.rb +9 -2
  13. data/lib/kentaa/api/request.rb +49 -5
  14. data/lib/kentaa/api/resources/action.rb +39 -15
  15. data/lib/kentaa/api/resources/activity.rb +11 -1
  16. data/lib/kentaa/api/resources/address.rb +7 -1
  17. data/lib/kentaa/api/resources/banner.rb +21 -1
  18. data/lib/kentaa/api/resources/base.rb +19 -6
  19. data/lib/kentaa/api/resources/consent.rb +7 -1
  20. data/lib/kentaa/api/resources/contact.rb +83 -0
  21. data/lib/kentaa/api/resources/donation.rb +30 -12
  22. data/lib/kentaa/api/resources/donation_form.rb +104 -0
  23. data/lib/kentaa/api/resources/error.rb +23 -0
  24. data/lib/kentaa/api/resources/list.rb +77 -2
  25. data/lib/kentaa/api/resources/location.rb +7 -1
  26. data/lib/kentaa/api/resources/manual_donation.rb +122 -0
  27. data/lib/kentaa/api/resources/newsletter_subscription.rb +16 -6
  28. data/lib/kentaa/api/resources/performance.rb +62 -0
  29. data/lib/kentaa/api/resources/photo.rb +21 -1
  30. data/lib/kentaa/api/resources/project.rb +37 -9
  31. data/lib/kentaa/api/resources/question.rb +19 -1
  32. data/lib/kentaa/api/resources/recurring_donor.rb +110 -0
  33. data/lib/kentaa/api/resources/registration_fee.rb +1 -1
  34. data/lib/kentaa/api/resources/resource.rb +43 -5
  35. data/lib/kentaa/api/resources/reward.rb +11 -1
  36. data/lib/kentaa/api/resources/segment.rb +35 -3
  37. data/lib/kentaa/api/resources/site.rb +15 -3
  38. data/lib/kentaa/api/{clients → resources}/sites.rb +2 -2
  39. data/lib/kentaa/api/resources/team.rb +22 -10
  40. data/lib/kentaa/api/resources/user.rb +16 -4
  41. data/lib/kentaa/api/resources/users.rb +5 -24
  42. data/lib/kentaa/api/resources/video.rb +21 -1
  43. data/lib/kentaa/api/response.rb +20 -2
  44. data/lib/kentaa/api/util.rb +13 -0
  45. data/lib/kentaa/api/version.rb +1 -1
  46. metadata +21 -30
  47. data/.travis.yml +0 -11
  48. data/lib/kentaa/api/clients/actions.rb +0 -21
  49. data/lib/kentaa/api/clients/all.rb +0 -26
  50. data/lib/kentaa/api/clients/base.rb +0 -15
  51. data/lib/kentaa/api/clients/donations.rb +0 -21
  52. data/lib/kentaa/api/clients/newsletter_subscriptions.rb +0 -21
  53. data/lib/kentaa/api/clients/projects.rb +0 -21
  54. data/lib/kentaa/api/clients/segments.rb +0 -21
  55. data/lib/kentaa/api/clients/teams.rb +0 -21
  56. data/lib/kentaa/api/clients/users.rb +0 -21
  57. data/lib/kentaa/api/finder.rb +0 -44
  58. data/lib/kentaa/api/resources/actions.rb +0 -37
  59. data/lib/kentaa/api/resources/donations.rb +0 -37
  60. data/lib/kentaa/api/resources/newsletter_subscriptions.rb +0 -37
  61. data/lib/kentaa/api/resources/projects.rb +0 -37
  62. data/lib/kentaa/api/resources/segments.rb +0 -37
  63. data/lib/kentaa/api/resources/teams.rb +0 -37
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kentaa
4
+ module Api
5
+ module Util
6
+ module_function
7
+
8
+ def pluralize(string)
9
+ "#{string}s"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Kentaa
4
4
  module Api
5
- VERSION = "0.3.0"
5
+ VERSION = "0.6.0"
6
6
  end
7
7
  end
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.3.0
4
+ version: 0.6.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: 2019-10-03 00:00:00.000000000 Z
11
+ date: 2021-06-24 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: '1.14'
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: '1.14'
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: '10.0'
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: '10.0'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -72,17 +72,17 @@ 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: []
79
79
  extensions: []
80
80
  extra_rdoc_files: []
81
81
  files:
82
+ - ".github/workflows/test.yml"
82
83
  - ".gitignore"
83
84
  - ".rspec"
84
85
  - ".rubocop.yml"
85
- - ".travis.yml"
86
86
  - Gemfile
87
87
  - Gemfile.lock
88
88
  - LICENSE.txt
@@ -93,55 +93,46 @@ files:
93
93
  - kentaa-api.gemspec
94
94
  - lib/kentaa/api.rb
95
95
  - lib/kentaa/api/client.rb
96
- - lib/kentaa/api/clients/actions.rb
97
- - lib/kentaa/api/clients/all.rb
98
- - lib/kentaa/api/clients/base.rb
99
- - lib/kentaa/api/clients/donations.rb
100
- - lib/kentaa/api/clients/newsletter_subscriptions.rb
101
- - lib/kentaa/api/clients/projects.rb
102
- - lib/kentaa/api/clients/segments.rb
103
- - lib/kentaa/api/clients/sites.rb
104
- - lib/kentaa/api/clients/teams.rb
105
- - lib/kentaa/api/clients/users.rb
106
96
  - lib/kentaa/api/config.rb
107
97
  - lib/kentaa/api/exception.rb
108
- - lib/kentaa/api/finder.rb
109
98
  - lib/kentaa/api/request.rb
110
99
  - lib/kentaa/api/resources/action.rb
111
- - lib/kentaa/api/resources/actions.rb
112
100
  - lib/kentaa/api/resources/activity.rb
113
101
  - lib/kentaa/api/resources/address.rb
114
102
  - lib/kentaa/api/resources/banner.rb
115
103
  - lib/kentaa/api/resources/base.rb
116
104
  - lib/kentaa/api/resources/consent.rb
105
+ - lib/kentaa/api/resources/contact.rb
117
106
  - lib/kentaa/api/resources/donation.rb
118
- - lib/kentaa/api/resources/donations.rb
107
+ - lib/kentaa/api/resources/donation_form.rb
108
+ - lib/kentaa/api/resources/error.rb
119
109
  - lib/kentaa/api/resources/list.rb
120
110
  - lib/kentaa/api/resources/location.rb
111
+ - lib/kentaa/api/resources/manual_donation.rb
121
112
  - lib/kentaa/api/resources/newsletter_subscription.rb
122
- - lib/kentaa/api/resources/newsletter_subscriptions.rb
113
+ - lib/kentaa/api/resources/performance.rb
123
114
  - lib/kentaa/api/resources/photo.rb
124
115
  - lib/kentaa/api/resources/project.rb
125
- - lib/kentaa/api/resources/projects.rb
126
116
  - lib/kentaa/api/resources/question.rb
117
+ - lib/kentaa/api/resources/recurring_donor.rb
127
118
  - lib/kentaa/api/resources/registration_fee.rb
128
119
  - lib/kentaa/api/resources/resource.rb
129
120
  - lib/kentaa/api/resources/reward.rb
130
121
  - lib/kentaa/api/resources/segment.rb
131
- - lib/kentaa/api/resources/segments.rb
132
122
  - lib/kentaa/api/resources/site.rb
123
+ - lib/kentaa/api/resources/sites.rb
133
124
  - lib/kentaa/api/resources/team.rb
134
- - lib/kentaa/api/resources/teams.rb
135
125
  - lib/kentaa/api/resources/user.rb
136
126
  - lib/kentaa/api/resources/users.rb
137
127
  - lib/kentaa/api/resources/video.rb
138
128
  - lib/kentaa/api/response.rb
129
+ - lib/kentaa/api/util.rb
139
130
  - lib/kentaa/api/version.rb
140
131
  homepage: https://github.com/KentaaNL/kentaa-api
141
132
  licenses:
142
133
  - MIT
143
134
  metadata: {}
144
- post_install_message:
135
+ post_install_message:
145
136
  rdoc_options: []
146
137
  require_paths:
147
138
  - lib
@@ -149,15 +140,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
149
140
  requirements:
150
141
  - - ">="
151
142
  - !ruby/object:Gem::Version
152
- version: 2.0.0
143
+ version: 2.4.0
153
144
  required_rubygems_version: !ruby/object:Gem::Requirement
154
145
  requirements:
155
146
  - - ">="
156
147
  - !ruby/object:Gem::Version
157
148
  version: '0'
158
149
  requirements: []
159
- rubygems_version: 3.0.6
160
- signing_key:
150
+ rubygems_version: 3.2.3
151
+ signing_key:
161
152
  specification_version: 4
162
153
  summary: Ruby library for communicating with the Kentaa API
163
154
  test_files: []
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- cache: bundler
4
- before_install:
5
- - gem update --system
6
- - gem update bundler
7
- rvm:
8
- - 2.3.8
9
- - 2.4.6
10
- - 2.5.5
11
- - 2.6.3
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kentaa
4
- module Api
5
- module Clients
6
- class Actions < Base
7
- include Kentaa::Api::Clients::All
8
-
9
- def list(options = {})
10
- actions = Kentaa::Api::Resources::Actions.new(config, options)
11
- actions.load
12
- end
13
-
14
- def get(id, options = {})
15
- action = Kentaa::Api::Resources::Action.new(config, options.merge(id: id))
16
- action.load
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -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 }
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,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kentaa
4
- module Api
5
- module Clients
6
- class Base
7
- attr_reader :config
8
-
9
- def initialize(config)
10
- @config = config
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kentaa
4
- module Api
5
- module Clients
6
- class Donations < Base
7
- include Kentaa::Api::Clients::All
8
-
9
- def list(options = {})
10
- donations = Kentaa::Api::Resources::Donations.new(config, options)
11
- donations.load
12
- end
13
-
14
- def get(id, options = {})
15
- donation = Kentaa::Api::Resources::Donation.new(config, options.merge(id: id))
16
- donation.load
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kentaa
4
- module Api
5
- module Clients
6
- class NewsletterSubscriptions < Base
7
- include Kentaa::Api::Clients::All
8
-
9
- def list(options = {})
10
- newsletter_subscriptions = Kentaa::Api::Resources::NewsletterSubscriptions.new(config, options)
11
- newsletter_subscriptions.load
12
- end
13
-
14
- def get(id, options = {})
15
- newsletter_subscription = Kentaa::Api::Resources::NewsletterSubscription.new(config, options.merge(id: id))
16
- newsletter_subscription.load
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kentaa
4
- module Api
5
- module Clients
6
- class Projects < Base
7
- include Kentaa::Api::Clients::All
8
-
9
- def list(options = {})
10
- projects = Kentaa::Api::Resources::Projects.new(config, options)
11
- projects.load
12
- end
13
-
14
- def get(id, options = {})
15
- project = Kentaa::Api::Resources::Project.new(config, options.merge(id: id))
16
- project.load
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kentaa
4
- module Api
5
- module Clients
6
- class Segments < Base
7
- include Kentaa::Api::Clients::All
8
-
9
- def list(options = {})
10
- segments = Kentaa::Api::Resources::Segments.new(config, options)
11
- segments.load
12
- end
13
-
14
- def get(id, options = {})
15
- segment = Kentaa::Api::Resources::Segment.new(config, options.merge(id: id))
16
- segment.load
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kentaa
4
- module Api
5
- module Clients
6
- class Teams < Base
7
- include Kentaa::Api::Clients::All
8
-
9
- def list(options = {})
10
- teams = Kentaa::Api::Resources::Teams.new(config, options)
11
- teams.load
12
- end
13
-
14
- def get(id, options = {})
15
- team = Kentaa::Api::Resources::Team.new(config, options.merge(id: id))
16
- team.load
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kentaa
4
- module Api
5
- module Clients
6
- class Users < Base
7
- include Kentaa::Api::Clients::All
8
-
9
- def list(options = {})
10
- users = Kentaa::Api::Resources::Users.new(config, options)
11
- users.load
12
- end
13
-
14
- def get(id, options = {})
15
- user = Kentaa::Api::Resources::User.new(config, options.merge(id: id))
16
- user.load
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kentaa
4
- module Api
5
- class Finder
6
- attr_reader :config
7
-
8
- def initialize(config)
9
- @config = config
10
- end
11
-
12
- def by_object_key(object_key)
13
- klass, id = object_key.split("_")
14
-
15
- case klass
16
- when "Action"
17
- client = Kentaa::Api::Clients::Actions.new(config)
18
- client.get(id)
19
- when "Donation"
20
- client = Kentaa::Api::Clients::Donations.new(config)
21
- client.get(id)
22
- when "NewsletterSubscription"
23
- client = Kentaa::Api::Clients::NewsletterSubscriptions.new(config)
24
- client.get(id)
25
- when "Project"
26
- client = Kentaa::Api::Clients::Projects.new(config)
27
- client.get(id)
28
- when "Segment"
29
- client = Kentaa::Api::Clients::Segments.new(config)
30
- client.get(id)
31
- when "Site"
32
- client = Kentaa::Api::Clients::Sites.new(config)
33
- client.current
34
- when "Team"
35
- client = Kentaa::Api::Clients::Teams.new(config)
36
- client.get(id)
37
- when "User"
38
- client = Kentaa::Api::Clients::Users.new(config)
39
- client.get(id)
40
- end
41
- end
42
- end
43
- end
44
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kentaa
4
- module Api
5
- module Resources
6
- class Actions < List
7
- include Enumerable
8
-
9
- def each(&block)
10
- actions.each(&block)
11
- end
12
-
13
- protected
14
-
15
- def load_resource(options)
16
- request.get("/actions", options)
17
- end
18
-
19
- private
20
-
21
- def actions
22
- @actions ||= begin
23
- actions = []
24
-
25
- if data
26
- data.each do |action|
27
- actions << Kentaa::Api::Resources::Action.new(config, data: action)
28
- end
29
- end
30
-
31
- actions
32
- end
33
- end
34
- end
35
- end
36
- end
37
- end