kentaa-api 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +0 -1
- data/.rubocop.yml +18 -1
- data/.travis.yml +7 -3
- data/Gemfile +4 -1
- data/Gemfile.lock +66 -0
- data/README.md +15 -0
- data/Rakefile +2 -0
- data/bin/console +1 -0
- data/kentaa-api.gemspec +2 -2
- data/lib/kentaa/api/client.rb +14 -8
- data/lib/kentaa/api/{http.rb → request.rb} +9 -10
- data/lib/kentaa/api/requests/actions.rb +4 -2
- data/lib/kentaa/api/requests/all.rb +3 -1
- data/lib/kentaa/api/requests/base.rb +5 -3
- data/lib/kentaa/api/requests/donations.rb +4 -2
- data/lib/kentaa/api/requests/newsletter_subscriptions.rb +8 -1
- data/lib/kentaa/api/requests/projects.rb +4 -2
- data/lib/kentaa/api/requests/segments.rb +4 -2
- data/lib/kentaa/api/requests/sites.rb +3 -1
- data/lib/kentaa/api/requests/teams.rb +4 -2
- data/lib/kentaa/api/requests/users.rb +21 -0
- data/lib/kentaa/api/response.rb +30 -0
- data/lib/kentaa/api/responses/action.rb +72 -6
- data/lib/kentaa/api/responses/actions.rb +4 -6
- data/lib/kentaa/api/responses/activity.rb +15 -0
- data/lib/kentaa/api/responses/address.rb +14 -4
- data/lib/kentaa/api/responses/banner.rb +2 -4
- data/lib/kentaa/api/responses/base.rb +19 -7
- data/lib/kentaa/api/responses/consent.rb +21 -0
- data/lib/kentaa/api/responses/donation.rb +38 -8
- data/lib/kentaa/api/responses/donations.rb +4 -6
- data/lib/kentaa/api/responses/location.rb +29 -0
- data/lib/kentaa/api/responses/newsletter_subscription.rb +20 -2
- data/lib/kentaa/api/responses/newsletter_subscriptions.rb +4 -6
- data/lib/kentaa/api/responses/pagination.rb +9 -5
- data/lib/kentaa/api/responses/photo.rb +2 -4
- data/lib/kentaa/api/responses/project.rb +31 -5
- data/lib/kentaa/api/responses/projects.rb +4 -6
- data/lib/kentaa/api/responses/question.rb +2 -4
- data/lib/kentaa/api/responses/registration_fee.rb +17 -0
- data/lib/kentaa/api/responses/resource.rb +2 -0
- data/lib/kentaa/api/responses/reward.rb +2 -4
- data/lib/kentaa/api/responses/segment.rb +7 -5
- data/lib/kentaa/api/responses/segments.rb +4 -6
- data/lib/kentaa/api/responses/site.rb +11 -5
- data/lib/kentaa/api/responses/status.rb +27 -0
- data/lib/kentaa/api/responses/team.rb +24 -6
- data/lib/kentaa/api/responses/teams.rb +4 -6
- data/lib/kentaa/api/responses/user.rb +89 -0
- data/lib/kentaa/api/responses/users.rb +32 -0
- data/lib/kentaa/api/responses/video.rb +2 -4
- data/lib/kentaa/api/version.rb +3 -1
- data/lib/kentaa/api.rb +12 -2
- metadata +15 -6
- data/lib/kentaa/api/responses/owner.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5c9f7ea46e68c4af626c227e7ef2bd787d181d487661f60a89c43f5ab7c3d9ac
|
4
|
+
data.tar.gz: dd3725827a82aa19ad4dfa6858e9a9d47b945a33cd8791410f2d2ce57d0c8e29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e03bd106dfab27111bdcb5ef44019b6cd7872254b22c27d91e35ba849b110c3e866a3f22ac6d9e72a7825ed8cef3f7898cfaf7691ac7f3d085a83a9dea4d4d7
|
7
|
+
data.tar.gz: be757c6cc5dd388820d05c400cdf2f59e593c82921b4c71374250ca490118315a4fbe4636bc63217fc4ebf2bbd6492c86efb298fd1d71c047c3b1fe49aaa953b
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,26 +1,43 @@
|
|
1
1
|
# Kentaa-API RuboCop configuration
|
2
2
|
|
3
|
+
require: rubocop-rspec
|
4
|
+
|
3
5
|
AllCops:
|
4
6
|
TargetRubyVersion: 2.3
|
5
7
|
DisplayCopNames: true
|
6
8
|
DisplayStyleGuide: true
|
7
9
|
|
10
|
+
Gemspec/RequiredRubyVersion:
|
11
|
+
Enabled: false
|
12
|
+
|
8
13
|
Metrics/AbcSize:
|
9
14
|
Enabled: false
|
10
15
|
|
11
16
|
Metrics/BlockLength:
|
12
17
|
Enabled: false
|
13
18
|
|
19
|
+
Metrics/ClassLength:
|
20
|
+
Enabled: false
|
21
|
+
|
14
22
|
Metrics/LineLength:
|
15
23
|
Enabled: false
|
16
24
|
|
17
25
|
Metrics/MethodLength:
|
18
26
|
Enabled: false
|
19
27
|
|
28
|
+
RSpec/DescribedClass:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
RSpec/ExampleLength:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
RSpec/MultipleExpectations:
|
35
|
+
Enabled: false
|
36
|
+
|
20
37
|
Style/Documentation:
|
21
38
|
Enabled: false
|
22
39
|
|
23
|
-
Style/
|
40
|
+
Style/ExpandPathArguments:
|
24
41
|
Enabled: false
|
25
42
|
|
26
43
|
Style/SafeNavigation:
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
kentaa-api (0.1.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
addressable (2.5.2)
|
10
|
+
public_suffix (>= 2.0.2, < 4.0)
|
11
|
+
ast (2.4.0)
|
12
|
+
crack (0.4.3)
|
13
|
+
safe_yaml (~> 1.0.0)
|
14
|
+
diff-lcs (1.3)
|
15
|
+
hashdiff (0.3.7)
|
16
|
+
jaro_winkler (1.5.3)
|
17
|
+
parallel (1.17.0)
|
18
|
+
parser (2.6.3.0)
|
19
|
+
ast (~> 2.4.0)
|
20
|
+
public_suffix (3.0.3)
|
21
|
+
rainbow (3.0.0)
|
22
|
+
rake (10.5.0)
|
23
|
+
rspec (3.8.0)
|
24
|
+
rspec-core (~> 3.8.0)
|
25
|
+
rspec-expectations (~> 3.8.0)
|
26
|
+
rspec-mocks (~> 3.8.0)
|
27
|
+
rspec-core (3.8.0)
|
28
|
+
rspec-support (~> 3.8.0)
|
29
|
+
rspec-expectations (3.8.2)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.8.0)
|
32
|
+
rspec-mocks (3.8.0)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.8.0)
|
35
|
+
rspec-support (3.8.0)
|
36
|
+
rubocop (0.72.0)
|
37
|
+
jaro_winkler (~> 1.5.1)
|
38
|
+
parallel (~> 1.10)
|
39
|
+
parser (>= 2.6)
|
40
|
+
rainbow (>= 2.2.2, < 4.0)
|
41
|
+
ruby-progressbar (~> 1.7)
|
42
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
43
|
+
rubocop-rspec (1.33.0)
|
44
|
+
rubocop (>= 0.60.0)
|
45
|
+
ruby-progressbar (1.10.1)
|
46
|
+
safe_yaml (1.0.4)
|
47
|
+
unicode-display_width (1.6.0)
|
48
|
+
webmock (2.3.2)
|
49
|
+
addressable (>= 2.3.6)
|
50
|
+
crack (>= 0.3.2)
|
51
|
+
hashdiff
|
52
|
+
|
53
|
+
PLATFORMS
|
54
|
+
ruby
|
55
|
+
|
56
|
+
DEPENDENCIES
|
57
|
+
bundler (~> 1.14)
|
58
|
+
kentaa-api!
|
59
|
+
rake (~> 10.0)
|
60
|
+
rspec (~> 3.0)
|
61
|
+
rubocop (~> 0.72.0)
|
62
|
+
rubocop-rspec (~> 1.33.0)
|
63
|
+
webmock (~> 2.3, >= 2.3.2)
|
64
|
+
|
65
|
+
BUNDLED WITH
|
66
|
+
1.17.1
|
data/README.md
CHANGED
@@ -96,6 +96,9 @@ See also the [Kentaa API documention](https://api.kentaa.nl/v1/doc/donations).
|
|
96
96
|
```ruby
|
97
97
|
newsletter_subscriptions = client.newsletter_subscriptions.all # get newsletter subscriptions (paginated)
|
98
98
|
newsletter_subscriptions = client.newsletter_subscriptions.list # get all newsletter subscriptions (non-paginated)
|
99
|
+
|
100
|
+
|
101
|
+
newsletter_subscriptions = client.newsletter_subscriptions.get(1) # query newsletter subscription by ID
|
99
102
|
```
|
100
103
|
|
101
104
|
See also the [Kentaa API documention](https://api.kentaa.nl/v1/doc/newsletter-subscriptions).
|
@@ -146,6 +149,18 @@ team = client.teams.get("team") # query team by slug
|
|
146
149
|
See also the [Kentaa API documention](https://api.kentaa.nl/v1/doc/teams).
|
147
150
|
|
148
151
|
|
152
|
+
#### Users
|
153
|
+
|
154
|
+
```ruby
|
155
|
+
users = client.users.list # get users (paginated)
|
156
|
+
users = client.users.all # get all users (non-paginated)
|
157
|
+
|
158
|
+
user = client.users.get(1) # query user by ID
|
159
|
+
```
|
160
|
+
|
161
|
+
See also the [Kentaa API documention](https://api.kentaa.nl/v1/doc/users).
|
162
|
+
|
163
|
+
|
149
164
|
## Development
|
150
165
|
|
151
166
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
data/kentaa-api.gemspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
lib = File.expand_path('../lib', __FILE__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.email = ["support@kentaa.nl"]
|
12
12
|
|
13
13
|
spec.summary = "Ruby library for communicating with the Kentaa API"
|
14
|
-
spec.homepage = "https://
|
14
|
+
spec.homepage = "https://github.com/KentaaNL/kentaa-api"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
data/lib/kentaa/api/client.rb
CHANGED
@@ -1,36 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Kentaa
|
2
4
|
module Api
|
3
5
|
class Client
|
4
6
|
def initialize(api_key, options = {})
|
5
|
-
@
|
7
|
+
@request = Kentaa::Api::Request.new(api_key, options)
|
6
8
|
end
|
7
9
|
|
8
10
|
def actions
|
9
|
-
Kentaa::Api::Requests::Actions.new(@
|
11
|
+
Kentaa::Api::Requests::Actions.new(@request)
|
10
12
|
end
|
11
13
|
|
12
14
|
def donations
|
13
|
-
Kentaa::Api::Requests::Donations.new(@
|
15
|
+
Kentaa::Api::Requests::Donations.new(@request)
|
14
16
|
end
|
15
17
|
|
16
18
|
def newsletter_subscriptions
|
17
|
-
Kentaa::Api::Requests::NewsletterSubscriptions.new(@
|
19
|
+
Kentaa::Api::Requests::NewsletterSubscriptions.new(@request)
|
18
20
|
end
|
19
21
|
|
20
22
|
def projects
|
21
|
-
Kentaa::Api::Requests::Projects.new(@
|
23
|
+
Kentaa::Api::Requests::Projects.new(@request)
|
22
24
|
end
|
23
25
|
|
24
26
|
def segments
|
25
|
-
Kentaa::Api::Requests::Segments.new(@
|
27
|
+
Kentaa::Api::Requests::Segments.new(@request)
|
26
28
|
end
|
27
29
|
|
28
30
|
def sites
|
29
|
-
Kentaa::Api::Requests::Sites.new(@
|
31
|
+
Kentaa::Api::Requests::Sites.new(@request)
|
30
32
|
end
|
31
33
|
|
32
34
|
def teams
|
33
|
-
Kentaa::Api::Requests::Teams.new(@
|
35
|
+
Kentaa::Api::Requests::Teams.new(@request)
|
36
|
+
end
|
37
|
+
|
38
|
+
def users
|
39
|
+
Kentaa::Api::Requests::Users.new(@request)
|
34
40
|
end
|
35
41
|
end
|
36
42
|
end
|
@@ -1,12 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'json'
|
2
4
|
require 'net/http'
|
3
5
|
require 'uri'
|
4
6
|
|
5
7
|
module Kentaa
|
6
8
|
module Api
|
7
|
-
class
|
8
|
-
LIVE_URL = "https://api.kentaa.nl/v1/"
|
9
|
-
TEST_URL = "https://api.kentaa.staatklaar.nu/v1/"
|
9
|
+
class Request
|
10
|
+
LIVE_URL = "https://api.kentaa.nl/v1/"
|
11
|
+
TEST_URL = "https://api.kentaa.staatklaar.nu/v1/"
|
12
|
+
DEV_URL = "http://api.lvh.me:3000/v1"
|
10
13
|
|
11
14
|
def initialize(api_key, options = {})
|
12
15
|
@api_key = api_key
|
@@ -24,13 +27,7 @@ module Kentaa
|
|
24
27
|
http.request(request)
|
25
28
|
end
|
26
29
|
|
27
|
-
|
28
|
-
JSON.parse(response.body, symbolize_names: true)
|
29
|
-
rescue JSON::ParserError => ex
|
30
|
-
{
|
31
|
-
message: "Unable to parse JSON: #{ex.message}"
|
32
|
-
}
|
33
|
-
end
|
30
|
+
Kentaa::Api::Response.new(response)
|
34
31
|
end
|
35
32
|
|
36
33
|
private
|
@@ -38,6 +35,8 @@ module Kentaa
|
|
38
35
|
def api_url
|
39
36
|
if @options[:test]
|
40
37
|
TEST_URL
|
38
|
+
elsif @options[:dev]
|
39
|
+
DEV_URL
|
41
40
|
else
|
42
41
|
LIVE_URL
|
43
42
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Kentaa
|
2
4
|
module Api
|
3
5
|
module Requests
|
@@ -5,12 +7,12 @@ module Kentaa
|
|
5
7
|
include Kentaa::Api::Requests::All
|
6
8
|
|
7
9
|
def list(options = {})
|
8
|
-
response =
|
10
|
+
response = request.get("/actions", options)
|
9
11
|
Kentaa::Api::Responses::Actions.new(response)
|
10
12
|
end
|
11
13
|
|
12
14
|
def get(id)
|
13
|
-
response =
|
15
|
+
response = request.get("/actions/#{id}")
|
14
16
|
Kentaa::Api::Responses::Action.new(response)
|
15
17
|
end
|
16
18
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Kentaa
|
2
4
|
module Api
|
3
5
|
module Requests
|
@@ -8,7 +10,7 @@ module Kentaa
|
|
8
10
|
|
9
11
|
loop do
|
10
12
|
response = list(options.merge(page: page))
|
11
|
-
response.each { |item| yielder.yield item }
|
13
|
+
response.each { |item| yielder.yield item } if response.success?
|
12
14
|
|
13
15
|
raise StopIteration unless response.next_page?
|
14
16
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Kentaa
|
2
4
|
module Api
|
3
5
|
module Requests
|
@@ -5,12 +7,12 @@ module Kentaa
|
|
5
7
|
include Kentaa::Api::Requests::All
|
6
8
|
|
7
9
|
def list(options = {})
|
8
|
-
response =
|
10
|
+
response = request.get("/donations", options)
|
9
11
|
Kentaa::Api::Responses::Donations.new(response)
|
10
12
|
end
|
11
13
|
|
12
14
|
def get(id)
|
13
|
-
response =
|
15
|
+
response = request.get("/donations/#{id}")
|
14
16
|
Kentaa::Api::Responses::Donation.new(response)
|
15
17
|
end
|
16
18
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Kentaa
|
2
4
|
module Api
|
3
5
|
module Requests
|
@@ -5,9 +7,14 @@ module Kentaa
|
|
5
7
|
include Kentaa::Api::Requests::All
|
6
8
|
|
7
9
|
def list(options = {})
|
8
|
-
response =
|
10
|
+
response = request.get("/newsletter-subscriptions", options)
|
9
11
|
Kentaa::Api::Responses::NewsletterSubscriptions.new(response)
|
10
12
|
end
|
13
|
+
|
14
|
+
def get(id)
|
15
|
+
response = request.get("/newsletter-subscriptions/#{id}")
|
16
|
+
Kentaa::Api::Responses::NewsletterSubscription.new(response)
|
17
|
+
end
|
11
18
|
end
|
12
19
|
end
|
13
20
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Kentaa
|
2
4
|
module Api
|
3
5
|
module Requests
|
@@ -5,12 +7,12 @@ module Kentaa
|
|
5
7
|
include Kentaa::Api::Requests::All
|
6
8
|
|
7
9
|
def list(options = {})
|
8
|
-
response =
|
10
|
+
response = request.get("/projects", options)
|
9
11
|
Kentaa::Api::Responses::Projects.new(response)
|
10
12
|
end
|
11
13
|
|
12
14
|
def get(id)
|
13
|
-
response =
|
15
|
+
response = request.get("/projects/#{id}")
|
14
16
|
Kentaa::Api::Responses::Project.new(response)
|
15
17
|
end
|
16
18
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Kentaa
|
2
4
|
module Api
|
3
5
|
module Requests
|
@@ -5,12 +7,12 @@ module Kentaa
|
|
5
7
|
include Kentaa::Api::Requests::All
|
6
8
|
|
7
9
|
def list(options = {})
|
8
|
-
response =
|
10
|
+
response = request.get("/segments", options)
|
9
11
|
Kentaa::Api::Responses::Segments.new(response)
|
10
12
|
end
|
11
13
|
|
12
14
|
def get(id)
|
13
|
-
response =
|
15
|
+
response = request.get("/segments/#{id}")
|
14
16
|
Kentaa::Api::Responses::Segment.new(response)
|
15
17
|
end
|
16
18
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Kentaa
|
2
4
|
module Api
|
3
5
|
module Requests
|
@@ -5,12 +7,12 @@ module Kentaa
|
|
5
7
|
include Kentaa::Api::Requests::All
|
6
8
|
|
7
9
|
def list(options = {})
|
8
|
-
response =
|
10
|
+
response = request.get("/teams", options)
|
9
11
|
Kentaa::Api::Responses::Teams.new(response)
|
10
12
|
end
|
11
13
|
|
12
14
|
def get(id)
|
13
|
-
response =
|
15
|
+
response = request.get("/teams/#{id}")
|
14
16
|
Kentaa::Api::Responses::Team.new(response)
|
15
17
|
end
|
16
18
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kentaa
|
4
|
+
module Api
|
5
|
+
module Requests
|
6
|
+
class Users < Base
|
7
|
+
include Kentaa::Api::Requests::All
|
8
|
+
|
9
|
+
def list(options = {})
|
10
|
+
response = request.get("/users", options)
|
11
|
+
Kentaa::Api::Responses::Users.new(response)
|
12
|
+
end
|
13
|
+
|
14
|
+
def get(id)
|
15
|
+
response = request.get("/users/#{id}")
|
16
|
+
Kentaa::Api::Responses::User.new(response)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Kentaa
|
6
|
+
module Api
|
7
|
+
class Response
|
8
|
+
attr_reader :response, :body
|
9
|
+
|
10
|
+
def initialize(response)
|
11
|
+
@response = response
|
12
|
+
@body = parse_body(response.body)
|
13
|
+
end
|
14
|
+
|
15
|
+
def code
|
16
|
+
response.code.to_i
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def parse_body(body)
|
22
|
+
JSON.parse(body, symbolize_names: true)
|
23
|
+
rescue JSON::ParserError => e
|
24
|
+
{
|
25
|
+
message: "Unable to parse JSON: #{e.message}"
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bigdecimal'
|
2
4
|
require 'time'
|
3
5
|
|
@@ -7,10 +9,6 @@ module Kentaa
|
|
7
9
|
class Action < Base
|
8
10
|
include Kentaa::Api::Responses::Resource
|
9
11
|
|
10
|
-
def initialize(response)
|
11
|
-
super(response[:action] || response)
|
12
|
-
end
|
13
|
-
|
14
12
|
def slug
|
15
13
|
data[:slug]
|
16
14
|
end
|
@@ -28,7 +26,35 @@ module Kentaa
|
|
28
26
|
end
|
29
27
|
|
30
28
|
def owner
|
31
|
-
@owner ||= Kentaa::Api::Responses::
|
29
|
+
@owner ||= Kentaa::Api::Responses::User.new(data[:owner])
|
30
|
+
end
|
31
|
+
|
32
|
+
def team_captain?
|
33
|
+
data[:team_captain]
|
34
|
+
end
|
35
|
+
|
36
|
+
def first_name
|
37
|
+
data[:first_name]
|
38
|
+
end
|
39
|
+
|
40
|
+
def infix
|
41
|
+
data[:infix]
|
42
|
+
end
|
43
|
+
|
44
|
+
def last_name
|
45
|
+
data[:last_name]
|
46
|
+
end
|
47
|
+
|
48
|
+
def avatar_url
|
49
|
+
data[:avatar_url]
|
50
|
+
end
|
51
|
+
|
52
|
+
def name
|
53
|
+
[first_name, infix, last_name].compact.join(" ")
|
54
|
+
end
|
55
|
+
|
56
|
+
def fundraiser_page?
|
57
|
+
data[:fundraiser_page]
|
32
58
|
end
|
33
59
|
|
34
60
|
def title
|
@@ -44,21 +70,45 @@ module Kentaa
|
|
44
70
|
end
|
45
71
|
|
46
72
|
def total_amount
|
47
|
-
BigDecimal
|
73
|
+
BigDecimal(data[:total_amount])
|
48
74
|
end
|
49
75
|
|
50
76
|
def total_donations
|
51
77
|
data[:total_donations]
|
52
78
|
end
|
53
79
|
|
80
|
+
def target_amount_achieved?
|
81
|
+
data[:target_amount_achieved]
|
82
|
+
end
|
83
|
+
|
54
84
|
def visible?
|
55
85
|
data[:visible]
|
56
86
|
end
|
57
87
|
|
88
|
+
def countable?
|
89
|
+
data[:countable]
|
90
|
+
end
|
91
|
+
|
92
|
+
def closed?
|
93
|
+
data[:closed]
|
94
|
+
end
|
95
|
+
|
96
|
+
def ended?
|
97
|
+
data[:ended]
|
98
|
+
end
|
99
|
+
|
58
100
|
def end_date
|
59
101
|
Time.parse(data[:end_date]) if data[:end_date]
|
60
102
|
end
|
61
103
|
|
104
|
+
def activity
|
105
|
+
@activity ||= Kentaa::Api::Responses::Activity.new(data[:activity])
|
106
|
+
end
|
107
|
+
|
108
|
+
def previous_participations
|
109
|
+
data[:previous_participations]
|
110
|
+
end
|
111
|
+
|
62
112
|
def url
|
63
113
|
data[:url]
|
64
114
|
end
|
@@ -67,6 +117,14 @@ module Kentaa
|
|
67
117
|
data[:donate_url]
|
68
118
|
end
|
69
119
|
|
120
|
+
def registration_fee
|
121
|
+
@registration_fee ||= Kentaa::Api::Responses::RegistrationFee.new(data[:registration_fee])
|
122
|
+
end
|
123
|
+
|
124
|
+
def location
|
125
|
+
@location ||= Kentaa::Api::Responses::Location.new(data[:location])
|
126
|
+
end
|
127
|
+
|
70
128
|
def photos
|
71
129
|
@photos ||= begin
|
72
130
|
photos = []
|
@@ -108,6 +166,14 @@ module Kentaa
|
|
108
166
|
questions
|
109
167
|
end
|
110
168
|
end
|
169
|
+
|
170
|
+
def consent
|
171
|
+
@consent ||= Kentaa::Api::Responses::Consent.new(data[:consent]) if data[:consent]
|
172
|
+
end
|
173
|
+
|
174
|
+
def external_reference
|
175
|
+
data[:external_reference]
|
176
|
+
end
|
111
177
|
end
|
112
178
|
end
|
113
179
|
end
|