kentaa-api 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +8 -1
  3. data/.travis.yml +5 -6
  4. data/Gemfile +4 -3
  5. data/Gemfile.lock +31 -23
  6. data/README.md +320 -66
  7. data/kentaa-api.gemspec +3 -3
  8. data/lib/kentaa/api.rb +6 -0
  9. data/lib/kentaa/api/client.rb +8 -0
  10. data/lib/kentaa/api/clients/actions.rb +2 -2
  11. data/lib/kentaa/api/clients/donation_forms.rb +24 -0
  12. data/lib/kentaa/api/clients/donations.rb +1 -1
  13. data/lib/kentaa/api/clients/manual_donations.rb +5 -5
  14. data/lib/kentaa/api/clients/newsletter_subscriptions.rb +1 -1
  15. data/lib/kentaa/api/clients/projects.rb +1 -1
  16. data/lib/kentaa/api/clients/recurring_donors.rb +24 -0
  17. data/lib/kentaa/api/clients/segments.rb +1 -1
  18. data/lib/kentaa/api/clients/sites.rb +1 -1
  19. data/lib/kentaa/api/clients/teams.rb +1 -1
  20. data/lib/kentaa/api/clients/users.rb +7 -2
  21. data/lib/kentaa/api/config.rb +4 -0
  22. data/lib/kentaa/api/exception.rb +5 -2
  23. data/lib/kentaa/api/request.rb +9 -0
  24. data/lib/kentaa/api/resources/action.rb +10 -6
  25. data/lib/kentaa/api/resources/actions.rb +2 -2
  26. data/lib/kentaa/api/resources/contact.rb +1 -1
  27. data/lib/kentaa/api/resources/donation.rb +16 -6
  28. data/lib/kentaa/api/resources/donation_form.rb +100 -0
  29. data/lib/kentaa/api/resources/donation_forms.rb +35 -0
  30. data/lib/kentaa/api/resources/donations.rb +1 -1
  31. data/lib/kentaa/api/resources/manual_donation.rb +15 -5
  32. data/lib/kentaa/api/resources/manual_donations.rb +2 -2
  33. data/lib/kentaa/api/resources/newsletter_subscription.rb +13 -3
  34. data/lib/kentaa/api/resources/newsletter_subscriptions.rb +1 -1
  35. data/lib/kentaa/api/resources/project.rb +10 -2
  36. data/lib/kentaa/api/resources/projects.rb +1 -1
  37. data/lib/kentaa/api/resources/question.rb +8 -0
  38. data/lib/kentaa/api/resources/recurring_donor.rb +110 -0
  39. data/lib/kentaa/api/resources/recurring_donors.rb +35 -0
  40. data/lib/kentaa/api/resources/resource.rb +6 -6
  41. data/lib/kentaa/api/resources/segment.rb +12 -0
  42. data/lib/kentaa/api/resources/segments.rb +1 -1
  43. data/lib/kentaa/api/resources/site.rb +4 -0
  44. data/lib/kentaa/api/resources/team.rb +9 -5
  45. data/lib/kentaa/api/resources/teams.rb +1 -1
  46. data/lib/kentaa/api/resources/user.rb +11 -1
  47. data/lib/kentaa/api/resources/users.rb +7 -2
  48. data/lib/kentaa/api/version.rb +1 -1
  49. metadata +14 -8
@@ -22,7 +22,7 @@ module Kentaa
22
22
 
23
23
  if data
24
24
  data.each do |team|
25
- teams << Kentaa::Api::Resources::Team.new(config, data: team)
25
+ teams << Kentaa::Api::Resources::Team.new(config, data: team, options: options)
26
26
  end
27
27
  end
28
28
 
@@ -10,6 +10,10 @@ module Kentaa
10
10
  "User_#{id}"
11
11
  end
12
12
 
13
+ def site
14
+ Kentaa::Api::Resources::Site.new(config, id: site_id, options: options)
15
+ end
16
+
13
17
  def site_id
14
18
  data[:site_id]
15
19
  end
@@ -75,7 +79,7 @@ module Kentaa
75
79
  end
76
80
 
77
81
  def birthday
78
- Time.parse(data[:birthday]) if data[:birthday]
82
+ Date.parse(data[:birthday]) if data[:birthday]
79
83
  end
80
84
 
81
85
  def gender
@@ -90,6 +94,12 @@ module Kentaa
90
94
  @consent ||= Kentaa::Api::Resources::Consent.new(data[:consent]) if data[:consent]
91
95
  end
92
96
 
97
+ def auth(attributes)
98
+ @response = request.post("/users/auth", options, attributes)
99
+
100
+ self
101
+ end
102
+
93
103
  private
94
104
 
95
105
  def load_resource
@@ -11,10 +11,15 @@ module Kentaa
11
11
  end
12
12
 
13
13
  def create(attributes = {})
14
- user = Kentaa::Api::Resources::User.new(config, options)
14
+ user = Kentaa::Api::Resources::User.new(config, options: options)
15
15
  user.save(attributes)
16
16
  end
17
17
 
18
+ def auth(attributes = {})
19
+ user = Kentaa::Api::Resources::User.new(config, options: options)
20
+ user.auth(attributes)
21
+ end
22
+
18
23
  private
19
24
 
20
25
  def load_resource
@@ -27,7 +32,7 @@ module Kentaa
27
32
 
28
33
  if data
29
34
  data.each do |user|
30
- users << Kentaa::Api::Resources::User.new(config, data: user)
35
+ users << Kentaa::Api::Resources::User.new(config, data: user, options: options)
31
36
  end
32
37
  end
33
38
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Kentaa
4
4
  module Api
5
- VERSION = "0.4.0"
5
+ VERSION = "0.5.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.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kentaa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-31 00:00:00.000000000 Z
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: '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: '12.3'
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: '12.3'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -95,10 +95,12 @@ files:
95
95
  - lib/kentaa/api/client.rb
96
96
  - lib/kentaa/api/clients/actions.rb
97
97
  - lib/kentaa/api/clients/base.rb
98
+ - lib/kentaa/api/clients/donation_forms.rb
98
99
  - lib/kentaa/api/clients/donations.rb
99
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
@@ -116,6 +118,8 @@ files:
116
118
  - lib/kentaa/api/resources/consent.rb
117
119
  - lib/kentaa/api/resources/contact.rb
118
120
  - lib/kentaa/api/resources/donation.rb
121
+ - lib/kentaa/api/resources/donation_form.rb
122
+ - lib/kentaa/api/resources/donation_forms.rb
119
123
  - lib/kentaa/api/resources/donations.rb
120
124
  - lib/kentaa/api/resources/error.rb
121
125
  - lib/kentaa/api/resources/list.rb
@@ -128,6 +132,8 @@ files:
128
132
  - lib/kentaa/api/resources/project.rb
129
133
  - lib/kentaa/api/resources/projects.rb
130
134
  - lib/kentaa/api/resources/question.rb
135
+ - lib/kentaa/api/resources/recurring_donor.rb
136
+ - lib/kentaa/api/resources/recurring_donors.rb
131
137
  - lib/kentaa/api/resources/registration_fee.rb
132
138
  - lib/kentaa/api/resources/resource.rb
133
139
  - lib/kentaa/api/resources/reward.rb
@@ -153,14 +159,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
153
159
  requirements:
154
160
  - - ">="
155
161
  - !ruby/object:Gem::Version
156
- version: 2.3.0
162
+ version: 2.4.0
157
163
  required_rubygems_version: !ruby/object:Gem::Requirement
158
164
  requirements:
159
165
  - - ">="
160
166
  - !ruby/object:Gem::Version
161
167
  version: '0'
162
168
  requirements: []
163
- rubygems_version: 3.1.2
169
+ rubygems_version: 3.2.3
164
170
  signing_key:
165
171
  specification_version: 4
166
172
  summary: Ruby library for communicating with the Kentaa API