kentaa-api 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +23 -0
- data/.rubocop.yml +1 -0
- data/Gemfile.lock +14 -14
- data/README.md +64 -21
- data/lib/kentaa/api.rb +4 -24
- data/lib/kentaa/api/client.rb +24 -24
- data/lib/kentaa/api/config.rb +6 -3
- data/lib/kentaa/api/request.rb +2 -2
- data/lib/kentaa/api/resources/action.rb +6 -2
- data/lib/kentaa/api/resources/base.rb +18 -5
- data/lib/kentaa/api/resources/donation_form.rb +7 -3
- data/lib/kentaa/api/resources/list.rb +61 -3
- data/lib/kentaa/api/resources/performance.rb +62 -0
- data/lib/kentaa/api/resources/project.rb +11 -3
- data/lib/kentaa/api/resources/recurring_donor.rb +1 -1
- data/lib/kentaa/api/resources/segment.rb +15 -3
- data/lib/kentaa/api/resources/site.rb +3 -3
- data/lib/kentaa/api/{clients → resources}/sites.rb +1 -1
- data/lib/kentaa/api/resources/team.rb +2 -2
- data/lib/kentaa/api/resources/user.rb +0 -6
- data/lib/kentaa/api/resources/users.rb +5 -32
- data/lib/kentaa/api/util.rb +13 -0
- data/lib/kentaa/api/version.rb +1 -1
- metadata +6 -25
- data/.travis.yml +0 -11
- data/lib/kentaa/api/clients/actions.rb +0 -34
- data/lib/kentaa/api/clients/base.rb +0 -15
- data/lib/kentaa/api/clients/donation_forms.rb +0 -24
- data/lib/kentaa/api/clients/donations.rb +0 -24
- data/lib/kentaa/api/clients/manual_donations.rb +0 -39
- data/lib/kentaa/api/clients/newsletter_subscriptions.rb +0 -24
- data/lib/kentaa/api/clients/projects.rb +0 -24
- data/lib/kentaa/api/clients/recurring_donors.rb +0 -24
- data/lib/kentaa/api/clients/segments.rb +0 -24
- data/lib/kentaa/api/clients/teams.rb +0 -24
- data/lib/kentaa/api/clients/users.rb +0 -39
- data/lib/kentaa/api/finder.rb +0 -44
- data/lib/kentaa/api/resources/actions.rb +0 -40
- data/lib/kentaa/api/resources/donation_forms.rb +0 -35
- data/lib/kentaa/api/resources/donations.rb +0 -35
- data/lib/kentaa/api/resources/manual_donations.rb +0 -40
- data/lib/kentaa/api/resources/newsletter_subscriptions.rb +0 -35
- data/lib/kentaa/api/resources/projects.rb +0 -35
- data/lib/kentaa/api/resources/recurring_donors.rb +0 -35
- data/lib/kentaa/api/resources/segments.rb +0 -35
- data/lib/kentaa/api/resources/teams.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da9bb3b58fe4533c642cd80ca677b29aff5e779aa1335ecbda2ba5c502133487
|
4
|
+
data.tar.gz: 3ad011c17955567de318e2e1c8f959afd3ea3f6aad8d66381f0d2c48abd7c6e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b00e2f9db7313a96e4d205337ae9c2a9d9872d5ff97865246a6b1b391ae47cd615c2e736eac0ea5a6e890cb553bbfa66d5ddf31b83a60dc6d48f580912a430d
|
7
|
+
data.tar.gz: 50f33d783a2055d71bdbf9bdc446be064bb109b71e04f6736e9dfb29b0dc670fe42001b89c218904405a218b3700c3d030fdd1c1292658b958ba77e62b9dafc3
|
@@ -0,0 +1,23 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby-version: ['2.4', '2.5', '2.6', '2.7', '3.0']
|
15
|
+
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v2
|
18
|
+
- uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: ${{ matrix.ruby-version }}
|
21
|
+
bundler-cache: true
|
22
|
+
- name: Run tests
|
23
|
+
run: bundle exec rake
|
data/.rubocop.yml
CHANGED
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.6.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -11,7 +11,7 @@ GEM
|
|
11
11
|
ast (2.4.2)
|
12
12
|
crack (0.4.3)
|
13
13
|
safe_yaml (~> 1.0.0)
|
14
|
-
diff-lcs (1.
|
14
|
+
diff-lcs (1.4.4)
|
15
15
|
hashdiff (0.3.7)
|
16
16
|
parallel (1.20.1)
|
17
17
|
parser (3.0.0.0)
|
@@ -20,20 +20,20 @@ GEM
|
|
20
20
|
rainbow (3.0.0)
|
21
21
|
rake (13.0.3)
|
22
22
|
regexp_parser (2.1.1)
|
23
|
-
rexml (3.2.
|
24
|
-
rspec (3.
|
25
|
-
rspec-core (~> 3.
|
26
|
-
rspec-expectations (~> 3.
|
27
|
-
rspec-mocks (~> 3.
|
28
|
-
rspec-core (3.
|
29
|
-
rspec-support (~> 3.
|
30
|
-
rspec-expectations (3.
|
23
|
+
rexml (3.2.5)
|
24
|
+
rspec (3.10.0)
|
25
|
+
rspec-core (~> 3.10.0)
|
26
|
+
rspec-expectations (~> 3.10.0)
|
27
|
+
rspec-mocks (~> 3.10.0)
|
28
|
+
rspec-core (3.10.1)
|
29
|
+
rspec-support (~> 3.10.0)
|
30
|
+
rspec-expectations (3.10.1)
|
31
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
-
rspec-support (~> 3.
|
33
|
-
rspec-mocks (3.
|
32
|
+
rspec-support (~> 3.10.0)
|
33
|
+
rspec-mocks (3.10.2)
|
34
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
-
rspec-support (~> 3.
|
36
|
-
rspec-support (3.
|
35
|
+
rspec-support (~> 3.10.0)
|
36
|
+
rspec-support (3.10.2)
|
37
37
|
rubocop (1.12.0)
|
38
38
|
parallel (~> 1.10)
|
39
39
|
parser (>= 3.0.0.0)
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Kentaa API
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/kentaa-api.svg)](https://badge.fury.io/rb/kentaa-api)
|
4
|
-
[![Build Status](https://
|
4
|
+
[![Build Status](https://github.com/KentaaNL/kentaa-api/actions/workflows/test.yml/badge.svg)](https://github.com/KentaaNL/kentaa-api/actions)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/KentaaNL/kentaa-api/badges/gpa.svg)](https://codeclimate.com/github/KentaaNL/kentaa-api)
|
6
6
|
|
7
7
|
This gem provides a Ruby library for communicating with the [Kentaa API](https://developer.kentaa.nl/kentaa-api/).
|
@@ -15,6 +15,7 @@ This gem provides a Ruby library for communicating with the [Kentaa API](https:/
|
|
15
15
|
- [Donations](#donations)
|
16
16
|
- [Manual donations](#manual-donations)
|
17
17
|
- [Newsletter subscriptions](#newsletter-subscriptions)
|
18
|
+
- [Performances](#performances)
|
18
19
|
- [Projects](#projects)
|
19
20
|
- [Recurring donors](#recurring-donors)
|
20
21
|
- [Segments](#segments)
|
@@ -45,26 +46,25 @@ Or install it yourself as:
|
|
45
46
|
|
46
47
|
## Usage
|
47
48
|
|
48
|
-
Create a Kentaa API
|
49
|
+
Create a Kentaa API client using your API key:
|
49
50
|
|
50
51
|
```ruby
|
51
52
|
require 'kentaa/api'
|
52
53
|
|
53
|
-
|
54
|
-
client = Kentaa::Api::Client.new(config)
|
54
|
+
client = Kentaa::Api::Client.new(api_key: 'your_api_key')
|
55
55
|
```
|
56
56
|
|
57
|
-
The
|
57
|
+
The client is created for the production environment by default. If you want to use the testing environment, then add `test: true`:
|
58
58
|
|
59
59
|
```ruby
|
60
|
-
|
60
|
+
client = Kentaa::Api::Client.new(api_key: 'your_api_key', test: true)
|
61
61
|
```
|
62
62
|
|
63
63
|
### Actions
|
64
64
|
|
65
65
|
```ruby
|
66
66
|
# List Actions
|
67
|
-
actions = client.actions
|
67
|
+
actions = client.actions # paginated
|
68
68
|
actions = client.actions.all # non-paginated
|
69
69
|
|
70
70
|
actions.each do |action|
|
@@ -103,7 +103,7 @@ See also the [Kentaa API docs](https://developer.kentaa.nl/kentaa-api/#actions)
|
|
103
103
|
|
104
104
|
```ruby
|
105
105
|
# List Donation forms
|
106
|
-
donation_forms = client.donation_forms
|
106
|
+
donation_forms = client.donation_forms # paginated
|
107
107
|
donation_forms = client.donation_forms.all # non-paginated
|
108
108
|
|
109
109
|
donation_forms.each do |form|
|
@@ -126,7 +126,7 @@ See also the [Kentaa API docs](https://developer.kentaa.nl/kentaa-api/#donation-
|
|
126
126
|
|
127
127
|
```ruby
|
128
128
|
# List Donations
|
129
|
-
donations = client.donations
|
129
|
+
donations = client.donations # paginated
|
130
130
|
donations = client.donations.all # non-paginated
|
131
131
|
|
132
132
|
donations.each do |donations|
|
@@ -149,7 +149,7 @@ See also the [Kentaa API docs](https://developer.kentaa.nl/kentaa-api/#donations
|
|
149
149
|
|
150
150
|
```ruby
|
151
151
|
# List Manual donations
|
152
|
-
donations = client.manual_donations
|
152
|
+
donations = client.manual_donations # paginated
|
153
153
|
donations = client.manual_donations.all # non-paginated
|
154
154
|
|
155
155
|
donations.each do |donations|
|
@@ -193,7 +193,7 @@ See also the [Kentaa API docs](https://developer.kentaa.nl/kentaa-api/#manual-do
|
|
193
193
|
|
194
194
|
```ruby
|
195
195
|
# List Newsletter subscriptions
|
196
|
-
newsletter_subscriptions = client.newsletter_subscriptions
|
196
|
+
newsletter_subscriptions = client.newsletter_subscriptions # paginated
|
197
197
|
newsletter_subscriptions = client.newsletter_subscriptions.all # non-paginated
|
198
198
|
|
199
199
|
newsletter_subscriptions.each do |subscription|
|
@@ -210,11 +210,55 @@ subscription.subscription_url # => "https://demo1.kentaa.nl"
|
|
210
210
|
|
211
211
|
See also the [Kentaa API docs](https://developer.kentaa.nl/kentaa-api/#newsletter-subscriptions) and [Kentaa::Api::Resources::NewsletterSubscription](lib/kentaa/api/resources/newsletter_subscription.rb) for all available properties.
|
212
212
|
|
213
|
+
### Performances
|
214
|
+
|
215
|
+
Performances are available on an [Kentaa::Api::Resources::Action](lib/kentaa/api/resources/action.rb), so you first need to retrieve an Action.
|
216
|
+
|
217
|
+
```ruby
|
218
|
+
action = client.actions.get(1)
|
219
|
+
|
220
|
+
# List Performances
|
221
|
+
performances = action.performances # paginated
|
222
|
+
performances = action.performances.all # non-paginated
|
223
|
+
|
224
|
+
performances.each do |performance|
|
225
|
+
performance.title # => "First tour"
|
226
|
+
performance.distance # => BigDecimal("65.25")
|
227
|
+
end
|
228
|
+
|
229
|
+
# Get Performance
|
230
|
+
donation = action.performances.get(1)
|
231
|
+
|
232
|
+
performance.title # => "First tour"
|
233
|
+
performance.distance # => BigDecimal("65.25")
|
234
|
+
|
235
|
+
# Create a Performance
|
236
|
+
performance = action.performances.create(
|
237
|
+
title: "First tour",
|
238
|
+
performance_type: "biking",
|
239
|
+
performance_at: Time.now,
|
240
|
+
distance: "65.25"
|
241
|
+
)
|
242
|
+
|
243
|
+
performance.title # => "First tour"
|
244
|
+
performance.distance # => BigDecimal("65.25")
|
245
|
+
|
246
|
+
# Update a Performance
|
247
|
+
performance = action.performance.update(1, title: "Big tour")
|
248
|
+
|
249
|
+
performance.title # => "Big tour"
|
250
|
+
|
251
|
+
# Delete a Performance
|
252
|
+
action.performance.delete(1)
|
253
|
+
```
|
254
|
+
|
255
|
+
See also the [Kentaa API docs](https://developer.kentaa.nl/kentaa-api/#performances) and [Kentaa::Api::Resources::Performance](lib/kentaa/api/resources/performance.rb) for all available properties.
|
256
|
+
|
213
257
|
### Projects
|
214
258
|
|
215
259
|
```ruby
|
216
260
|
# List Projects
|
217
|
-
projects = client.projects
|
261
|
+
projects = client.projects # paginated
|
218
262
|
projects = client.projects.all # non-paginated
|
219
263
|
|
220
264
|
projects.each do |project|
|
@@ -237,7 +281,7 @@ See also the [Kentaa API docs](https://developer.kentaa.nl/kentaa-api/#projects)
|
|
237
281
|
|
238
282
|
```ruby
|
239
283
|
# List Recurring donors
|
240
|
-
recurring_donors = client.recurring_donors
|
284
|
+
recurring_donors = client.recurring_donors # paginated
|
241
285
|
recurring_donors = client.recurring_donors.all # non-paginated
|
242
286
|
|
243
287
|
recurring_donors.each do |recurring_donor|
|
@@ -260,7 +304,7 @@ See also the [Kentaa API docs](https://developer.kentaa.nl/kentaa-api/#recurring
|
|
260
304
|
|
261
305
|
```ruby
|
262
306
|
# List Segments
|
263
|
-
segments = client.segments
|
307
|
+
segments = client.segments # paginated
|
264
308
|
segments = client.segments.all # non-paginated
|
265
309
|
|
266
310
|
segments.each do |segment|
|
@@ -298,7 +342,7 @@ See also the [Kentaa API docs](https://developer.kentaa.nl/kentaa-api/#sites) an
|
|
298
342
|
|
299
343
|
```ruby
|
300
344
|
# List Teams
|
301
|
-
teams = client.teams
|
345
|
+
teams = client.teams # paginated
|
302
346
|
teams = client.teams.all # non-paginated
|
303
347
|
|
304
348
|
teams.each do |team|
|
@@ -321,7 +365,7 @@ See also the [Kentaa API docs](https://developer.kentaa.nl/kentaa-api/#teams) an
|
|
321
365
|
|
322
366
|
```ruby
|
323
367
|
# List Users
|
324
|
-
users = client.users
|
368
|
+
users = client.users # paginated
|
325
369
|
users = client.users.all # non-paginated
|
326
370
|
|
327
371
|
users.each do |user|
|
@@ -362,11 +406,10 @@ See also the [Kentaa API docs](https://developer.kentaa.nl/kentaa-api/#users) an
|
|
362
406
|
|
363
407
|
### Pagination
|
364
408
|
|
365
|
-
|
366
|
-
Default page size is 25, but you can can customize this by setting the `per_page` parameter:
|
409
|
+
All List actions return paginated results in an [Enumerable](https://ruby-doc.org/core/Enumerable.html) object. The default page size is 25, but you can can customize this by setting the `per_page` parameter.
|
367
410
|
|
368
411
|
```ruby
|
369
|
-
actions = client.actions
|
412
|
+
actions = client.actions(per_page: 100)
|
370
413
|
|
371
414
|
actions.each do |action|
|
372
415
|
action.title # => "Lorem ipsum"
|
@@ -374,10 +417,10 @@ actions.each do |action|
|
|
374
417
|
end
|
375
418
|
```
|
376
419
|
|
377
|
-
You can iterate through the pages using the `.next` method and checking the result:
|
420
|
+
You can iterate through the pages using the `.next` method and checking the result. For example:
|
378
421
|
|
379
422
|
```ruby
|
380
|
-
actions = client.actions
|
423
|
+
actions = client.actions
|
381
424
|
|
382
425
|
loop do
|
383
426
|
actions.each do |action|
|
data/lib/kentaa/api.rb
CHANGED
@@ -1,52 +1,32 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "api/clients/base"
|
4
|
-
require_relative "api/clients/actions"
|
5
|
-
require_relative "api/clients/donation_forms"
|
6
|
-
require_relative "api/clients/donations"
|
7
|
-
require_relative "api/clients/manual_donations"
|
8
|
-
require_relative "api/clients/newsletter_subscriptions"
|
9
|
-
require_relative "api/clients/projects"
|
10
|
-
require_relative "api/clients/recurring_donors"
|
11
|
-
require_relative "api/clients/segments"
|
12
|
-
require_relative "api/clients/sites"
|
13
|
-
require_relative "api/clients/teams"
|
14
|
-
require_relative "api/clients/users"
|
15
|
-
|
16
3
|
require_relative "api/resources/base"
|
17
4
|
require_relative "api/resources/error"
|
18
5
|
require_relative "api/resources/list"
|
19
6
|
require_relative "api/resources/resource"
|
20
7
|
|
21
8
|
require_relative "api/resources/action"
|
22
|
-
require_relative "api/resources/actions"
|
23
9
|
require_relative "api/resources/activity"
|
24
10
|
require_relative "api/resources/address"
|
25
11
|
require_relative "api/resources/banner"
|
26
12
|
require_relative "api/resources/consent"
|
27
13
|
require_relative "api/resources/contact"
|
28
14
|
require_relative "api/resources/donation_form"
|
29
|
-
require_relative "api/resources/donation_forms"
|
30
15
|
require_relative "api/resources/donation"
|
31
|
-
require_relative "api/resources/donations"
|
32
16
|
require_relative "api/resources/location"
|
33
17
|
require_relative "api/resources/manual_donation"
|
34
|
-
require_relative "api/resources/manual_donations"
|
35
18
|
require_relative "api/resources/newsletter_subscription"
|
36
|
-
require_relative "api/resources/
|
19
|
+
require_relative "api/resources/performance"
|
37
20
|
require_relative "api/resources/photo"
|
38
21
|
require_relative "api/resources/project"
|
39
|
-
require_relative "api/resources/projects"
|
40
|
-
require_relative "api/resources/question"
|
41
22
|
require_relative "api/resources/recurring_donor"
|
42
|
-
require_relative "api/resources/recurring_donors"
|
43
23
|
require_relative "api/resources/registration_fee"
|
44
24
|
require_relative "api/resources/reward"
|
25
|
+
require_relative "api/resources/question"
|
45
26
|
require_relative "api/resources/segment"
|
46
|
-
require_relative "api/resources/segments"
|
47
27
|
require_relative "api/resources/site"
|
28
|
+
require_relative "api/resources/sites"
|
48
29
|
require_relative "api/resources/team"
|
49
|
-
require_relative "api/resources/teams"
|
50
30
|
require_relative "api/resources/user"
|
51
31
|
require_relative "api/resources/users"
|
52
32
|
require_relative "api/resources/video"
|
@@ -54,8 +34,8 @@ require_relative "api/resources/video"
|
|
54
34
|
require_relative "api/client"
|
55
35
|
require_relative "api/config"
|
56
36
|
require_relative "api/exception"
|
57
|
-
require_relative "api/finder"
|
58
37
|
require_relative "api/request"
|
59
38
|
require_relative "api/response"
|
39
|
+
require_relative "api/util"
|
60
40
|
|
61
41
|
require_relative "api/version"
|
data/lib/kentaa/api/client.rb
CHANGED
@@ -3,52 +3,52 @@
|
|
3
3
|
module Kentaa
|
4
4
|
module Api
|
5
5
|
class Client
|
6
|
-
def initialize(
|
7
|
-
@config =
|
6
|
+
def initialize(options = {})
|
7
|
+
@config = Kentaa::Api::Config.new(options)
|
8
8
|
end
|
9
9
|
|
10
|
-
def actions
|
11
|
-
Kentaa::Api::
|
10
|
+
def actions(options = {})
|
11
|
+
Kentaa::Api::Resources::List.new(@config, options.merge(resource_class: Kentaa::Api::Resources::Action, endpoint_path: "/actions"))
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
15
|
-
Kentaa::Api::
|
14
|
+
def donations(options = {})
|
15
|
+
Kentaa::Api::Resources::List.new(@config, options.merge(resource_class: Kentaa::Api::Resources::Donation, endpoint_path: "/donations"))
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
Kentaa::Api::
|
18
|
+
def donation_forms(options = {})
|
19
|
+
Kentaa::Api::Resources::List.new(@config, options.merge(resource_class: Kentaa::Api::Resources::DonationForm, endpoint_path: "/donation-forms"))
|
20
20
|
end
|
21
21
|
|
22
|
-
def manual_donations
|
23
|
-
Kentaa::Api::
|
22
|
+
def manual_donations(options = {})
|
23
|
+
Kentaa::Api::Resources::List.new(@config, options.merge(resource_class: Kentaa::Api::Resources::ManualDonation, endpoint_path: "/manual-donations"))
|
24
24
|
end
|
25
25
|
|
26
|
-
def newsletter_subscriptions
|
27
|
-
Kentaa::Api::
|
26
|
+
def newsletter_subscriptions(options = {})
|
27
|
+
Kentaa::Api::Resources::List.new(@config, options.merge(resource_class: Kentaa::Api::Resources::NewsletterSubscription, endpoint_path: "/newsletter-subscriptions"))
|
28
28
|
end
|
29
29
|
|
30
|
-
def projects
|
31
|
-
Kentaa::Api::
|
30
|
+
def projects(options = {})
|
31
|
+
Kentaa::Api::Resources::List.new(@config, options.merge(resource_class: Kentaa::Api::Resources::Project, endpoint_path: "/projects"))
|
32
32
|
end
|
33
33
|
|
34
|
-
def recurring_donors
|
35
|
-
Kentaa::Api::
|
34
|
+
def recurring_donors(options = {})
|
35
|
+
Kentaa::Api::Resources::List.new(@config, options.merge(resource_class: Kentaa::Api::Resources::RecurringDonor, endpoint_path: "/recurring-donors"))
|
36
36
|
end
|
37
37
|
|
38
|
-
def segments
|
39
|
-
Kentaa::Api::
|
38
|
+
def segments(options = {})
|
39
|
+
Kentaa::Api::Resources::List.new(@config, options.merge(resource_class: Kentaa::Api::Resources::Segment, endpoint_path: "/segments"))
|
40
40
|
end
|
41
41
|
|
42
|
-
def sites
|
43
|
-
Kentaa::Api::
|
42
|
+
def sites(options = {})
|
43
|
+
Kentaa::Api::Resources::Sites.new(@config, options)
|
44
44
|
end
|
45
45
|
|
46
|
-
def teams
|
47
|
-
Kentaa::Api::
|
46
|
+
def teams(options = {})
|
47
|
+
Kentaa::Api::Resources::List.new(@config, options.merge(resource_class: Kentaa::Api::Resources::Team, endpoint_path: "/teams"))
|
48
48
|
end
|
49
49
|
|
50
|
-
def users
|
51
|
-
Kentaa::Api::
|
50
|
+
def users(options = {})
|
51
|
+
Kentaa::Api::Resources::Users.new(@config, options)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
data/lib/kentaa/api/config.rb
CHANGED
@@ -7,13 +7,16 @@ module Kentaa
|
|
7
7
|
TEST_URL = "https://api.kentaa.staatklaar.nu/v1"
|
8
8
|
DEV_URL = "http://api.lvh.me:3000/v1"
|
9
9
|
|
10
|
-
attr_accessor :
|
10
|
+
attr_accessor :options
|
11
11
|
|
12
|
-
def initialize(
|
13
|
-
@api_key = api_key
|
12
|
+
def initialize(options = {})
|
14
13
|
@options = options
|
15
14
|
end
|
16
15
|
|
16
|
+
def api_key
|
17
|
+
options.fetch(:api_key)
|
18
|
+
end
|
19
|
+
|
17
20
|
def api_url
|
18
21
|
case environment
|
19
22
|
when :test
|