kentaa-api 0.4.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +414 -66
- data/lib/kentaa/api/client.rb +32 -20
- data/lib/kentaa/api/config.rb +13 -6
- data/lib/kentaa/api/deprecation.rb +13 -0
- data/lib/kentaa/api/exception.rb +5 -2
- data/lib/kentaa/api/request.rb +37 -19
- data/lib/kentaa/api/resources/action.rb +50 -11
- data/lib/kentaa/api/resources/base.rb +18 -5
- data/lib/kentaa/api/resources/billing.rb +51 -0
- data/lib/kentaa/api/resources/company.rb +218 -0
- data/lib/kentaa/api/resources/company_package.rb +39 -0
- data/lib/kentaa/api/resources/consent.rb +77 -4
- data/lib/kentaa/api/resources/contact.rb +2 -2
- data/lib/kentaa/api/resources/donation.rb +45 -7
- data/lib/kentaa/api/resources/donation_form.rb +104 -0
- data/lib/kentaa/api/resources/list.rb +61 -3
- data/lib/kentaa/api/resources/manual_donation.rb +17 -7
- data/lib/kentaa/api/resources/newsletter_subscription.rb +30 -4
- data/lib/kentaa/api/resources/performance.rb +70 -0
- data/lib/kentaa/api/resources/performance_photo.rb +36 -0
- data/lib/kentaa/api/resources/project.rb +36 -4
- data/lib/kentaa/api/resources/question.rb +8 -0
- data/lib/kentaa/api/resources/recurring_donor.rb +110 -0
- data/lib/kentaa/api/resources/resource.rb +6 -6
- data/lib/kentaa/api/resources/segment.rb +26 -2
- data/lib/kentaa/api/resources/site.rb +7 -3
- data/lib/kentaa/api/{clients → resources}/sites.rb +2 -2
- data/lib/kentaa/api/resources/team.rb +11 -7
- data/lib/kentaa/api/resources/user.rb +27 -3
- data/lib/kentaa/api/resources/users.rb +5 -27
- data/lib/kentaa/api/util.rb +17 -0
- data/lib/kentaa/api/version.rb +1 -1
- data/lib/kentaa/api.rb +41 -50
- metadata +23 -46
- data/.gitignore +0 -16
- data/.rspec +0 -2
- data/.rubocop.yml +0 -64
- data/.travis.yml +0 -12
- data/Gemfile +0 -10
- data/Gemfile.lock +0 -71
- data/Rakefile +0 -10
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/kentaa-api.gemspec +0 -30
- data/lib/kentaa/api/clients/actions.rb +0 -34
- data/lib/kentaa/api/clients/base.rb +0 -15
- 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/segments.rb +0 -24
- data/lib/kentaa/api/clients/teams.rb +0 -24
- data/lib/kentaa/api/clients/users.rb +0 -34
- data/lib/kentaa/api/finder.rb +0 -44
- data/lib/kentaa/api/resources/actions.rb +0 -40
- 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/segments.rb +0 -35
- data/lib/kentaa/api/resources/teams.rb +0 -35
data/lib/kentaa/api/finder.rb
DELETED
@@ -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,40 +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
|
-
def create(attributes = {})
|
14
|
-
action = Kentaa::Api::Resources::Action.new(config, options)
|
15
|
-
action.save(attributes)
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def load_resource
|
21
|
-
request.get("/actions", options)
|
22
|
-
end
|
23
|
-
|
24
|
-
def actions
|
25
|
-
@actions ||= begin
|
26
|
-
actions = []
|
27
|
-
|
28
|
-
if data
|
29
|
-
data.each do |action|
|
30
|
-
actions << Kentaa::Api::Resources::Action.new(config, data: action)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
actions
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kentaa
|
4
|
-
module Api
|
5
|
-
module Resources
|
6
|
-
class Donations < List
|
7
|
-
include Enumerable
|
8
|
-
|
9
|
-
def each(&block)
|
10
|
-
donations.each(&block)
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def load_resource
|
16
|
-
request.get("/donations", options)
|
17
|
-
end
|
18
|
-
|
19
|
-
def donations
|
20
|
-
@donations ||= begin
|
21
|
-
donations = []
|
22
|
-
|
23
|
-
if data
|
24
|
-
data.each do |donation|
|
25
|
-
donations << Kentaa::Api::Resources::Donation.new(config, data: donation)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
donations
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kentaa
|
4
|
-
module Api
|
5
|
-
module Resources
|
6
|
-
class ManualDonations < List
|
7
|
-
include Enumerable
|
8
|
-
|
9
|
-
def each(&block)
|
10
|
-
manual_donations.each(&block)
|
11
|
-
end
|
12
|
-
|
13
|
-
def create(attributes = {})
|
14
|
-
donation = Kentaa::Api::Resources::ManualDonation.new(config, options)
|
15
|
-
donation.save(attributes)
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def load_resource
|
21
|
-
request.get("/manual-donations", options)
|
22
|
-
end
|
23
|
-
|
24
|
-
def manual_donations
|
25
|
-
@manual_donations ||= begin
|
26
|
-
manual_donations = []
|
27
|
-
|
28
|
-
if data
|
29
|
-
data.each do |manual_donation|
|
30
|
-
manual_donations << Kentaa::Api::Resources::ManualDonation.new(config, data: manual_donation)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
manual_donations
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kentaa
|
4
|
-
module Api
|
5
|
-
module Resources
|
6
|
-
class NewsletterSubscriptions < List
|
7
|
-
include Enumerable
|
8
|
-
|
9
|
-
def each(&block)
|
10
|
-
newsletter_subscriptions.each(&block)
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def load_resource
|
16
|
-
request.get("/newsletter-subscriptions", options)
|
17
|
-
end
|
18
|
-
|
19
|
-
def newsletter_subscriptions
|
20
|
-
@newsletter_subscriptions ||= begin
|
21
|
-
newsletter_subscriptions = []
|
22
|
-
|
23
|
-
if data
|
24
|
-
data.each do |newsletter_subscription|
|
25
|
-
newsletter_subscriptions << Kentaa::Api::Resources::NewsletterSubscription.new(config, data: newsletter_subscription)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
newsletter_subscriptions
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kentaa
|
4
|
-
module Api
|
5
|
-
module Resources
|
6
|
-
class Projects < List
|
7
|
-
include Enumerable
|
8
|
-
|
9
|
-
def each(&block)
|
10
|
-
projects.each(&block)
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def load_resource
|
16
|
-
request.get("/projects", options)
|
17
|
-
end
|
18
|
-
|
19
|
-
def projects
|
20
|
-
@projects ||= begin
|
21
|
-
projects = []
|
22
|
-
|
23
|
-
if data
|
24
|
-
data.each do |project|
|
25
|
-
projects << Kentaa::Api::Resources::Project.new(config, data: project)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
projects
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kentaa
|
4
|
-
module Api
|
5
|
-
module Resources
|
6
|
-
class Segments < List
|
7
|
-
include Enumerable
|
8
|
-
|
9
|
-
def each(&block)
|
10
|
-
segments.each(&block)
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def load_resource
|
16
|
-
request.get("/segments", options)
|
17
|
-
end
|
18
|
-
|
19
|
-
def segments
|
20
|
-
@segments ||= begin
|
21
|
-
segments = []
|
22
|
-
|
23
|
-
if data
|
24
|
-
data.each do |segment|
|
25
|
-
segments << Kentaa::Api::Resources::Segment.new(config, data: segment)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
segments
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kentaa
|
4
|
-
module Api
|
5
|
-
module Resources
|
6
|
-
class Teams < List
|
7
|
-
include Enumerable
|
8
|
-
|
9
|
-
def each(&block)
|
10
|
-
teams.each(&block)
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def load_resource
|
16
|
-
request.get("/teams", options)
|
17
|
-
end
|
18
|
-
|
19
|
-
def teams
|
20
|
-
@teams ||= begin
|
21
|
-
teams = []
|
22
|
-
|
23
|
-
if data
|
24
|
-
data.each do |team|
|
25
|
-
teams << Kentaa::Api::Resources::Team.new(config, data: team)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
teams
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|