stbaldricks 12.13.0.alpha.1 → 12.13.0.alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/stbaldricks/configuration.rb +2 -2
- data/lib/stbaldricks/default_logger.rb +2 -2
- data/lib/stbaldricks/endpoints/blog_post.rb +8 -8
- data/lib/stbaldricks/endpoints/communicate.rb +1 -1
- data/lib/stbaldricks/endpoints/config.rb +1 -1
- data/lib/stbaldricks/endpoints/deduplicator_match.rb +2 -2
- data/lib/stbaldricks/endpoints/kid.rb +1 -1
- data/lib/stbaldricks/endpoints/lib/entity.rb +11 -13
- data/lib/stbaldricks/endpoints/message.rb +20 -0
- data/lib/stbaldricks/endpoints/newsletter_recipient.rb +5 -11
- data/lib/stbaldricks/endpoints/participant.rb +3 -3
- data/lib/stbaldricks/endpoints/photo.rb +4 -5
- data/lib/stbaldricks/endpoints/search.rb +2 -2
- data/lib/stbaldricks/endpoints/user.rb +1 -1
- data/lib/stbaldricks/entities/batch.rb +5 -3
- data/lib/stbaldricks/entities/blog_post.rb +7 -1
- data/lib/stbaldricks/entities/campaign.rb +13 -6
- data/lib/stbaldricks/entities/challenge.rb +6 -4
- data/lib/stbaldricks/entities/challenger.rb +6 -4
- data/lib/stbaldricks/entities/concerns/entity_response_concern.rb +1 -1
- data/lib/stbaldricks/entities/config.rb +8 -3
- data/lib/stbaldricks/entities/contact.rb +7 -4
- data/lib/stbaldricks/entities/contact_group.rb +2 -2
- data/lib/stbaldricks/entities/deduplicator_history.rb +6 -1
- data/lib/stbaldricks/entities/deduplicator_match.rb +7 -4
- data/lib/stbaldricks/entities/disease.rb +5 -2
- data/lib/stbaldricks/entities/document_library.rb +8 -3
- data/lib/stbaldricks/entities/document_library_category.rb +4 -1
- data/lib/stbaldricks/entities/donation.rb +18 -12
- data/lib/stbaldricks/entities/donor.rb +5 -1
- data/lib/stbaldricks/entities/event.rb +44 -32
- data/lib/stbaldricks/entities/event_application.rb +10 -6
- data/lib/stbaldricks/entities/event_donation_summary.rb +5 -2
- data/lib/stbaldricks/entities/event_participant_summary.rb +3 -1
- data/lib/stbaldricks/entities/event_supporter.rb +3 -3
- data/lib/stbaldricks/entities/fund.rb +23 -6
- data/lib/stbaldricks/entities/fundraiser.rb +29 -16
- data/lib/stbaldricks/entities/grant.rb +25 -12
- data/lib/stbaldricks/entities/institution.rb +4 -3
- data/lib/stbaldricks/entities/international_partner.rb +16 -4
- data/lib/stbaldricks/entities/kid.rb +28 -11
- data/lib/stbaldricks/entities/kid_honor.rb +0 -1
- data/lib/stbaldricks/entities/kid_institution.rb +2 -2
- data/lib/stbaldricks/entities/lib/address.rb +6 -3
- data/lib/stbaldricks/entities/lib/alternate_shipping_address.rb +3 -1
- data/lib/stbaldricks/entities/lib/base.rb +39 -47
- data/lib/stbaldricks/entities/lib/collection.rb +2 -2
- data/lib/stbaldricks/entities/lib/email_address.rb +2 -1
- data/lib/stbaldricks/entities/lib/fundraising_page.rb +2 -1
- data/lib/stbaldricks/entities/lib/location.rb +0 -1
- data/lib/stbaldricks/entities/lib/milestone.rb +3 -1
- data/lib/stbaldricks/entities/lib/name.rb +2 -2
- data/lib/stbaldricks/entities/lib/not_implemented_object.rb +1 -1
- data/lib/stbaldricks/entities/lib/permissions.rb +4 -2
- data/lib/stbaldricks/entities/lib/phone.rb +3 -2
- data/lib/stbaldricks/entities/lib/third_party_media.rb +5 -1
- data/lib/stbaldricks/entities/lib/top_level.rb +1 -1
- data/lib/stbaldricks/entities/matching_gift_company.rb +39 -16
- data/lib/stbaldricks/entities/memorial.rb +14 -9
- data/lib/stbaldricks/entities/message.rb +16 -4
- data/lib/stbaldricks/entities/organization.rb +17 -11
- data/lib/stbaldricks/entities/page.rb +15 -9
- data/lib/stbaldricks/entities/participant.rb +28 -18
- data/lib/stbaldricks/entities/participant_donation_summary.rb +4 -2
- data/lib/stbaldricks/entities/person.rb +26 -22
- data/lib/stbaldricks/entities/person_donation_by_year_summary.rb +2 -1
- data/lib/stbaldricks/entities/photo.rb +11 -5
- data/lib/stbaldricks/entities/recurring_gift.rb +18 -10
- data/lib/stbaldricks/entities/response.rb +0 -1
- data/lib/stbaldricks/entities/search.rb +168 -30
- data/lib/stbaldricks/entities/section.rb +4 -1
- data/lib/stbaldricks/entities/shave_schedule.rb +13 -4
- data/lib/stbaldricks/entities/summary.rb +7 -1
- data/lib/stbaldricks/entities/team.rb +16 -12
- data/lib/stbaldricks/entities/team_donation_summary.rb +4 -2
- data/lib/stbaldricks/request.rb +2 -2
- data/lib/stbaldricks/version.rb +1 -1
- data/lib/stbaldricks_factories.rb +5 -0
- data/spec/factories/address.rb +14 -0
- data/spec/factories/campaign/totals.rb +9 -0
- data/spec/factories/campaign.rb +9 -0
- data/spec/factories/challenge.rb +19 -0
- data/spec/factories/challenger.rb +33 -0
- data/spec/factories/collection.rb +17 -0
- data/spec/factories/contact.rb +18 -0
- data/spec/factories/contact_group.rb +18 -0
- data/spec/factories/diagnosis.rb +12 -0
- data/spec/factories/disease.rb +11 -0
- data/spec/factories/donation/participant.rb +27 -0
- data/spec/factories/donation.rb +68 -0
- data/spec/factories/donor.rb +13 -0
- data/spec/factories/email_address.rb +11 -0
- data/spec/factories/error.rb +9 -0
- data/spec/factories/event/coach_tracking/coaching_interactions.rb +12 -0
- data/spec/factories/event/coach_tracking/plaque.rb +12 -0
- data/spec/factories/event/coach_tracking/proceeds.rb +12 -0
- data/spec/factories/event/coach_tracking.rb +18 -0
- data/spec/factories/event/contacts/contact.rb +17 -0
- data/spec/factories/event/contacts/name_pieces.rb +12 -0
- data/spec/factories/event/contacts.rb +16 -0
- data/spec/factories/event/photos.rb +12 -0
- data/spec/factories/event/totals.rb +15 -0
- data/spec/factories/event/venue/location.rb +18 -0
- data/spec/factories/event/venue/social.rb +16 -0
- data/spec/factories/event/venue.rb +16 -0
- data/spec/factories/event.rb +66 -0
- data/spec/factories/event_application.rb +34 -0
- data/spec/factories/event_supporter.rb +19 -0
- data/spec/factories/fund.rb +18 -0
- data/spec/factories/fundraiser/photos.rb +12 -0
- data/spec/factories/fundraiser/policies.rb +11 -0
- data/spec/factories/fundraiser/totals.rb +11 -0
- data/spec/factories/fundraiser.rb +24 -0
- data/spec/factories/fundraising_page.rb +29 -0
- data/spec/factories/grant.rb +22 -0
- data/spec/factories/grant_institution.rb +17 -0
- data/spec/factories/institution.rb +18 -0
- data/spec/factories/kid/custom_institution.rb +12 -0
- data/spec/factories/kid.rb +58 -0
- data/spec/factories/kid_honor.rb +16 -0
- data/spec/factories/kid_institution.rb +23 -0
- data/spec/factories/lib/faker_patch.rb +27 -0
- data/spec/factories/lib/helpers.rb +7 -0
- data/spec/factories/location.rb +17 -0
- data/spec/factories/memorial/photos.rb +14 -0
- data/spec/factories/memorial/totals.rb +11 -0
- data/spec/factories/memorial/tribute.rb +19 -0
- data/spec/factories/memorial.rb +22 -0
- data/spec/factories/message.rb +31 -0
- data/spec/factories/milestone.rb +15 -0
- data/spec/factories/name_pieces.rb +24 -0
- data/spec/factories/newsletter_recipient.rb +13 -0
- data/spec/factories/organization/addresses.rb +16 -0
- data/spec/factories/organization/email_addresses.rb +14 -0
- data/spec/factories/organization/phone_numbers.rb +14 -0
- data/spec/factories/organization.rb +34 -0
- data/spec/factories/page.rb +5 -0
- data/spec/factories/participant/photos.rb +14 -0
- data/spec/factories/participant/policies.rb +12 -0
- data/spec/factories/participant/rankings/ranking.rb +12 -0
- data/spec/factories/participant/rankings.rb +16 -0
- data/spec/factories/participant/roles/role.rb +154 -0
- data/spec/factories/participant/roles.rb +37 -0
- data/spec/factories/participant/totals.rb +11 -0
- data/spec/factories/participant.rb +95 -0
- data/spec/factories/payment.rb +13 -0
- data/spec/factories/permissions.rb +12 -0
- data/spec/factories/person/addresses.rb +16 -0
- data/spec/factories/person/email_addresses.rb +14 -0
- data/spec/factories/person/phone_numbers.rb +14 -0
- data/spec/factories/person/policies.rb +13 -0
- data/spec/factories/person.rb +22 -0
- data/spec/factories/phone.rb +11 -0
- data/spec/factories/photo.rb +11 -0
- data/spec/factories/photos.rb +9 -0
- data/spec/factories/recurring_gift.rb +22 -0
- data/spec/factories/researcher.rb +15 -0
- data/spec/factories/response.rb +38 -0
- data/spec/factories/search_event.rb +19 -0
- data/spec/factories/search_fundraiser.rb +15 -0
- data/spec/factories/search_kid.rb +13 -0
- data/spec/factories/search_participant.rb +15 -0
- data/spec/factories/search_team.rb +13 -0
- data/spec/factories/shave_schedule/time_selection_permissions.rb +12 -0
- data/spec/factories/shave_schedule.rb +33 -0
- data/spec/factories/team/photos.rb +12 -0
- data/spec/factories/team/rankings/ranking.rb +12 -0
- data/spec/factories/team/rankings.rb +15 -0
- data/spec/factories/team/totals.rb +14 -0
- data/spec/factories/team.rb +43 -0
- data/spec/factories/third_party_media.rb +12 -0
- data/spec/factories/treatment_status.rb +10 -0
- data/spec/factories/user.rb +14 -0
- data/spec/factories/venue.rb +15 -0
- metadata +275 -81
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b0b2e60b416d7ca4badb0f0f513c88fea4a2cb95fdbc21dc156d3961cbb66561
|
|
4
|
+
data.tar.gz: 463f554fc38e1ca5143b0e6647e0fcd18f625ed3276fbbbea590f475a964c5c0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f88d6d38f27ce3a7c8cb8a50ca5c371210389f80138758ccf7fada2c2f78deb6c21521a65ba7a68d7b095f32c57c008cb95b27d90d1f190bab2ae562869ce9a8
|
|
7
|
+
data.tar.gz: effac8958624769f3668274e0db21474925e14cf7e66c04851173d63c87a901136674aec30d0035ad3f276a80a70b6a93c585f8d79f529e1953a6630f966f056
|
|
@@ -16,11 +16,11 @@ module SBF
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def self.base_uri
|
|
19
|
-
@base_uri ||= ENV
|
|
19
|
+
@base_uri ||= ENV['API_ENDPOINT'] || DEFAULT_API_ENDPOINT
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def self.general_token
|
|
23
|
-
@general_token ||= ENV
|
|
23
|
+
@general_token ||= ENV['API_KEY'] || raise(SBF::Client::Configuration::Error.new('general_token', 'must be set'))
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def self.request_id
|
|
@@ -3,7 +3,7 @@ require 'logger'
|
|
|
3
3
|
module SBF
|
|
4
4
|
module Client
|
|
5
5
|
module DefaultLogger
|
|
6
|
-
def self.instance(default_stream =
|
|
6
|
+
def self.instance(default_stream = STDOUT)
|
|
7
7
|
formatter = proc { |severity, datetime, _, msg|
|
|
8
8
|
# ruby logger docs suggested this method for escaping messages since messages may contain user input
|
|
9
9
|
# and are not escaped by default.
|
|
@@ -16,7 +16,7 @@ module SBF
|
|
|
16
16
|
|
|
17
17
|
logger.formatter = formatter
|
|
18
18
|
logger.level = ::Logger::DEBUG
|
|
19
|
-
logger.level = ENV
|
|
19
|
+
logger.level = ENV['SBF_CLIENT_LOG_LEVEL'] || ::Logger::DEBUG
|
|
20
20
|
logger
|
|
21
21
|
end
|
|
22
22
|
end
|
|
@@ -27,17 +27,17 @@ module SBF
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
def find_by_term(term, order = {}, limit = 10, offset = 0, show_hidden
|
|
30
|
+
def find_by_term(term, order = {}, limit = 10, offset = 0, show_hidden = true)
|
|
31
31
|
# Build the parameter list for search; an empty find is supported
|
|
32
32
|
filter = {}
|
|
33
33
|
filter[:type] = FILTER_BY_TERM
|
|
34
34
|
filter[:term] = term unless term.empty?
|
|
35
35
|
filter[:show_hidden] = show_hidden
|
|
36
36
|
|
|
37
|
-
find(filter
|
|
37
|
+
find(filter, order, limit, offset)
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
def find_by_author(author, order = {}, limit = 10, offset = 0, show_hidden
|
|
40
|
+
def find_by_author(author, order = {}, limit = 10, offset = 0, show_hidden = true)
|
|
41
41
|
raise SBF::Client::Error, 'Must provide author for the query' if author.empty?
|
|
42
42
|
|
|
43
43
|
filter = {}
|
|
@@ -45,10 +45,10 @@ module SBF
|
|
|
45
45
|
filter[:term] = author
|
|
46
46
|
filter[:show_hidden] = show_hidden
|
|
47
47
|
|
|
48
|
-
find(filter
|
|
48
|
+
find(filter, order, limit, offset)
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
-
def find_by_category(category, order = {}, limit = 10, offset = 0, show_hidden
|
|
51
|
+
def find_by_category(category, order = {}, limit = 10, offset = 0, show_hidden = true)
|
|
52
52
|
raise SBF::Client::Error, 'Must provide category for the query' if category.empty?
|
|
53
53
|
|
|
54
54
|
filter = {}
|
|
@@ -56,10 +56,10 @@ module SBF
|
|
|
56
56
|
filter[:term] = category
|
|
57
57
|
filter[:show_hidden] = show_hidden
|
|
58
58
|
|
|
59
|
-
find(filter
|
|
59
|
+
find(filter, order, limit, offset)
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
-
def find_by_tag(tag, order = {}, limit = 10, offset = 0, show_hidden
|
|
62
|
+
def find_by_tag(tag, order = {}, limit = 10, offset = 0, show_hidden = true)
|
|
63
63
|
raise SBF::Client::Error, 'Must provide tag for the query' if tag.empty?
|
|
64
64
|
|
|
65
65
|
filter = {}
|
|
@@ -67,7 +67,7 @@ module SBF
|
|
|
67
67
|
filter[:term] = tag
|
|
68
68
|
filter[:show_hidden] = show_hidden
|
|
69
69
|
|
|
70
|
-
find(filter
|
|
70
|
+
find(filter, order, limit, offset)
|
|
71
71
|
end
|
|
72
72
|
end
|
|
73
73
|
end
|
|
@@ -48,7 +48,7 @@ module SBF
|
|
|
48
48
|
group_id: group_id
|
|
49
49
|
)
|
|
50
50
|
parsed_response_body = JSON.parse(response.body).symbolize!
|
|
51
|
-
parsed_response_body.map! { |c| SBF::Client::Contact.new(c
|
|
51
|
+
parsed_response_body.map! { |c| SBF::Client::Contact.new(c) } if ok?(response)
|
|
52
52
|
|
|
53
53
|
handle_parsed_response(parsed_response_body, response)
|
|
54
54
|
end
|
|
@@ -11,7 +11,7 @@ module SBF
|
|
|
11
11
|
raise SBF::Client::StandardError, 'Unable to retrieve settings from the api' unless ok?(response)
|
|
12
12
|
|
|
13
13
|
# re-call initalize with the new api data. This should re-set all of the instance variables on the instance
|
|
14
|
-
entity.send(:initialize, parsed_response_body
|
|
14
|
+
entity.send(:initialize, parsed_response_body)
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
end
|
|
@@ -3,7 +3,7 @@ require 'stbaldricks/endpoints/lib/entity'
|
|
|
3
3
|
module SBF
|
|
4
4
|
module Client
|
|
5
5
|
class DeduplicatorMatchEndpoint < SBF::Client::EntityEndpoint
|
|
6
|
-
def checkout(filter
|
|
6
|
+
def checkout(filter = [], order = {}, limit = 20, offset = 0, with = {})
|
|
7
7
|
filter = filter.to_json unless filter.is_a? String
|
|
8
8
|
order = order.to_json unless order.is_a? String
|
|
9
9
|
with = normalize_with(with)
|
|
@@ -15,7 +15,7 @@ module SBF
|
|
|
15
15
|
parsed_response_body = JSON.parse(response.body).symbolize!
|
|
16
16
|
|
|
17
17
|
if ok?(response)
|
|
18
|
-
parsed_response_body[:results].map! { |entity_data| target_class.new(entity_data,
|
|
18
|
+
parsed_response_body[:results].map! { |entity_data| target_class.new(entity_data, true) }
|
|
19
19
|
SBF::Client::EntityCollection.new(parsed_response_body[:results], parsed_response_body[:total_count])
|
|
20
20
|
else
|
|
21
21
|
parsed_response_body = JSON.parse(response.body).symbolize!
|
|
@@ -12,7 +12,7 @@ module SBF
|
|
|
12
12
|
parsed_response_body = JSON.parse(response.body).symbolize!
|
|
13
13
|
|
|
14
14
|
if ok?(response)
|
|
15
|
-
parsed_response_body[:results].map! { |entity_data| target_class.new(entity_data
|
|
15
|
+
parsed_response_body[:results].map! { |entity_data| target_class.new(entity_data) }
|
|
16
16
|
SBF::Client::EntityCollection.new(parsed_response_body[:results], parsed_response_body[:total_count])
|
|
17
17
|
else
|
|
18
18
|
parsed_response_body = JSON.parse(response.body).symbolize!
|
|
@@ -10,7 +10,8 @@ require 'json'
|
|
|
10
10
|
module SBF
|
|
11
11
|
module Client
|
|
12
12
|
class EntityEndpoint
|
|
13
|
-
attr_reader :orig_target_class
|
|
13
|
+
attr_reader :orig_target_class
|
|
14
|
+
attr_reader :base_uri
|
|
14
15
|
|
|
15
16
|
def initialize(target_class)
|
|
16
17
|
@orig_target_class = target_class
|
|
@@ -33,7 +34,7 @@ module SBF
|
|
|
33
34
|
# @param with [Hash] The optional entity fields to include in the response
|
|
34
35
|
# @return entity [SBF::Client::BaseEntity]
|
|
35
36
|
def create(entity_or_hash, with = {})
|
|
36
|
-
entity = entity_or_hash.is_a?(Hash) ? target_class.new(entity_or_hash
|
|
37
|
+
entity = entity_or_hash.is_a?(Hash) ? target_class.new(entity_or_hash) : entity_or_hash
|
|
37
38
|
raise SBF::Client::Error, 'Invalid Entity' unless entity.is_a?(SBF::Client::BaseEntity)
|
|
38
39
|
|
|
39
40
|
with = normalize_with(with, entity)
|
|
@@ -49,11 +50,10 @@ module SBF
|
|
|
49
50
|
# @param with [Hash] The optional entity fields to include in the response
|
|
50
51
|
# @return entity [SBF::Client::BaseEntity]
|
|
51
52
|
def update(id = nil, entity_or_hash = nil, with = {})
|
|
52
|
-
|
|
53
|
-
when SBF::Client::BaseEntity
|
|
53
|
+
if entity_or_hash.is_a?(SBF::Client::BaseEntity)
|
|
54
54
|
# If someone has passed in an entity, just convert it to a hash
|
|
55
55
|
data = entity_or_hash.dirty_data
|
|
56
|
-
|
|
56
|
+
elsif entity_or_hash.is_a?(Hash)
|
|
57
57
|
# If someone has passed in a hash, make sure all of it's values match fields in the entity class
|
|
58
58
|
data = sanitize(entity_or_hash)
|
|
59
59
|
else
|
|
@@ -89,7 +89,7 @@ module SBF
|
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
# Calls the find route for the entity.
|
|
92
|
-
def find(filter
|
|
92
|
+
def find(filter = [], order = {}, limit = 20, offset = 0, with = {})
|
|
93
93
|
filter = filter.to_json unless filter.is_a? String
|
|
94
94
|
order = order.to_json unless order.is_a? String
|
|
95
95
|
with = normalize_with(with)
|
|
@@ -98,9 +98,7 @@ module SBF
|
|
|
98
98
|
parsed_response_body = JSON.parse(response.body).symbolize!
|
|
99
99
|
|
|
100
100
|
if ok?(response)
|
|
101
|
-
parsed_response_body[:results].map!
|
|
102
|
-
target_class.new(entity_data, clear_changes: true)
|
|
103
|
-
end
|
|
101
|
+
parsed_response_body[:results].map! { |entity_data| target_class.new(entity_data, true) }
|
|
104
102
|
SBF::Client::EntityCollection.new(parsed_response_body[:results], parsed_response_body[:total_count])
|
|
105
103
|
else
|
|
106
104
|
parsed_response_body = JSON.parse(response.body).symbolize!
|
|
@@ -115,7 +113,7 @@ module SBF
|
|
|
115
113
|
|
|
116
114
|
# Calls the find route for the entity.
|
|
117
115
|
def find_first(filter = [], order = {}, with = {})
|
|
118
|
-
response = find(filter
|
|
116
|
+
response = find(filter, order, 1, 0, with)
|
|
119
117
|
if response.is_a?(SBF::Client::EntityCollection)
|
|
120
118
|
response.empty? ? nil : response.first
|
|
121
119
|
else
|
|
@@ -150,7 +148,7 @@ module SBF
|
|
|
150
148
|
|
|
151
149
|
def target_class
|
|
152
150
|
class_name_pieces = @orig_target_class.to_s.split('::')
|
|
153
|
-
full_name = (class_name_pieces[0..-2] + [
|
|
151
|
+
full_name = (class_name_pieces[0..-2] + ['Full' + class_name_pieces.last]).join('::')
|
|
154
152
|
Object.const_defined?(full_name) ? Object.const_get(full_name) : @orig_target_class
|
|
155
153
|
end
|
|
156
154
|
private :target_class
|
|
@@ -249,7 +247,7 @@ module SBF
|
|
|
249
247
|
entity_or_hash.send(:initialize_attributes, new_data)
|
|
250
248
|
entity = entity_or_hash
|
|
251
249
|
else
|
|
252
|
-
entity = target_class.new(new_data
|
|
250
|
+
entity = target_class.new(new_data)
|
|
253
251
|
end
|
|
254
252
|
|
|
255
253
|
# Reload entity and its sub-entities so that no fields have a 'changed' state
|
|
@@ -258,7 +256,7 @@ module SBF
|
|
|
258
256
|
entity
|
|
259
257
|
else
|
|
260
258
|
error = SBF::Client::ApiErrorEntity.new(parsed_response_body.merge(http_code: response.code))
|
|
261
|
-
entity = entity_or_hash.is_a?(SBF::Client::BaseEntity) ? entity_or_hash : target_class.new(entity_or_hash
|
|
259
|
+
entity = entity_or_hash.is_a?(SBF::Client::BaseEntity) ? entity_or_hash : target_class.new(entity_or_hash)
|
|
262
260
|
entity.add_errors(error)
|
|
263
261
|
entity.errors_http_code = response.code
|
|
264
262
|
|
|
@@ -23,6 +23,7 @@ module SBF
|
|
|
23
23
|
SBF::Client::Api::Response.new(http_code: response.code, data: response, error: error)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
+
# Contact Us Form - SBF Notification Message
|
|
26
27
|
# rubocop:disable Metrics/ParameterLists
|
|
27
28
|
def send_contact_us_message(name, sender_email, phone, subject, body, sender_profile_id)
|
|
28
29
|
response = SBF::Client::Api::Request.post_request(
|
|
@@ -40,6 +41,25 @@ module SBF
|
|
|
40
41
|
SBF::Client::Api::Response.new(http_code: response.code, data: response, error: error)
|
|
41
42
|
end
|
|
42
43
|
# rubocop:enable Metrics/ParameterLists
|
|
44
|
+
|
|
45
|
+
# Contact Us Form - Submitter Response Message
|
|
46
|
+
# rubocop:disable Metrics/ParameterLists
|
|
47
|
+
def send_contact_us_response_message(name, sender_email, phone, subject, body, sender_profile_id)
|
|
48
|
+
response = SBF::Client::Api::Request.post_request(
|
|
49
|
+
"#{base_uri}/send_contact_us_response_message",
|
|
50
|
+
name: name,
|
|
51
|
+
sender_email: sender_email,
|
|
52
|
+
phone: phone,
|
|
53
|
+
subject: subject,
|
|
54
|
+
body: body,
|
|
55
|
+
sender_profile_id: sender_profile_id
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
error = SBF::Client::ErrorEntity.new(response) unless ok?(response)
|
|
59
|
+
|
|
60
|
+
SBF::Client::Api::Response.new(http_code: response.code, data: response, error: error)
|
|
61
|
+
end
|
|
62
|
+
# rubocop:enable Metrics/ParameterLists
|
|
43
63
|
end
|
|
44
64
|
end
|
|
45
65
|
end
|
|
@@ -3,14 +3,9 @@ require 'stbaldricks/endpoints/lib/entity'
|
|
|
3
3
|
module SBF
|
|
4
4
|
module Client
|
|
5
5
|
class NewsletterRecipientEndpoint < EntityEndpoint
|
|
6
|
-
def subscribe(entity_or_email, first_name = nil, last_name = nil, welcome_email
|
|
6
|
+
def subscribe(entity_or_email, first_name = nil, last_name = nil, welcome_email = true)
|
|
7
7
|
if entity_or_email.is_a?(String) && entity_or_email && first_name && last_name
|
|
8
|
-
entity = target_class.new(
|
|
9
|
-
email_address: entity_or_email,
|
|
10
|
-
first_name: first_name,
|
|
11
|
-
last_name: last_name,
|
|
12
|
-
welcome_email: welcome_email
|
|
13
|
-
}, clear_changes: false)
|
|
8
|
+
entity = target_class.new(email_address: entity_or_email, first_name: first_name, last_name: last_name, welcome_email: welcome_email)
|
|
14
9
|
elsif entity_or_email.is_a?(SBF::Client::BaseEntity)
|
|
15
10
|
entity = entity_or_email
|
|
16
11
|
else
|
|
@@ -26,10 +21,9 @@ module SBF
|
|
|
26
21
|
end
|
|
27
22
|
|
|
28
23
|
def unsubscribe(entity_or_email)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
when SBF::Client::BaseEntity
|
|
24
|
+
if entity_or_email.is_a?(String)
|
|
25
|
+
entity = target_class.new(email_address: entity_or_email)
|
|
26
|
+
elsif entity_or_email.is_a?(SBF::Client::BaseEntity)
|
|
33
27
|
entity = entity_or_email
|
|
34
28
|
else
|
|
35
29
|
raise SBF::Client::Error, 'Invalid Entity'
|
|
@@ -7,7 +7,7 @@ module SBF
|
|
|
7
7
|
response = SBF::Client::Api::Request.post_request("#{base_uri}/move_to_different_team", id: participant_id, new_team_id: new_team_id)
|
|
8
8
|
|
|
9
9
|
if ok?(response)
|
|
10
|
-
data = SBF::Client::FullParticipant.new(JSON.parse(response.body).symbolize
|
|
10
|
+
data = SBF::Client::FullParticipant.new(JSON.parse(response.body).symbolize!)
|
|
11
11
|
else
|
|
12
12
|
error = SBF::Client::ErrorEntity.new(JSON.parse(response.body).symbolize!)
|
|
13
13
|
end
|
|
@@ -26,7 +26,7 @@ module SBF
|
|
|
26
26
|
)
|
|
27
27
|
|
|
28
28
|
if ok?(response)
|
|
29
|
-
data = SBF::Client::FullParticipant.new(JSON.parse(response.body).symbolize
|
|
29
|
+
data = SBF::Client::FullParticipant.new(JSON.parse(response.body).symbolize!)
|
|
30
30
|
else
|
|
31
31
|
error = SBF::Client::ErrorEntity.new(JSON.parse(response.body).symbolize!)
|
|
32
32
|
end
|
|
@@ -38,7 +38,7 @@ module SBF
|
|
|
38
38
|
response = SBF::Client::Api::Request.post_request("#{base_uri}/move_to_different_team", id: participant_id, new_team_id: 0)
|
|
39
39
|
|
|
40
40
|
if ok?(response)
|
|
41
|
-
data = SBF::Client::FullParticipant.new(JSON.parse(response.body).symbolize
|
|
41
|
+
data = SBF::Client::FullParticipant.new(JSON.parse(response.body).symbolize!)
|
|
42
42
|
else
|
|
43
43
|
error = SBF::Client::ErrorEntity.new(JSON.parse(response.body).symbolize!)
|
|
44
44
|
end
|
|
@@ -4,7 +4,7 @@ module SBF
|
|
|
4
4
|
module Client
|
|
5
5
|
class PhotoEndpoint < SBF::Client::EntityEndpoint
|
|
6
6
|
def create(entity_or_hash, with = {})
|
|
7
|
-
entity = entity_or_hash.is_a?(Hash) ? target_class.new(entity_or_hash
|
|
7
|
+
entity = entity_or_hash.is_a?(Hash) ? target_class.new(entity_or_hash) : entity_or_hash
|
|
8
8
|
raise SBF::Client::Error, 'Invalid Entity' unless entity.is_a?(SBF::Client::BaseEntity)
|
|
9
9
|
|
|
10
10
|
with = normalize_with(with)
|
|
@@ -20,13 +20,12 @@ module SBF
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def update(id = nil, entity_or_hash = nil, with = {})
|
|
23
|
-
|
|
24
|
-
when SBF::Client::BaseEntity
|
|
23
|
+
if entity_or_hash.is_a?(SBF::Client::BaseEntity)
|
|
25
24
|
# If someone has passed in an entity, just convert it to a hash
|
|
26
25
|
data = entity_or_hash.dirty_data
|
|
27
26
|
data[:id] = id unless id.nil?
|
|
28
27
|
data[:id] = entity_or_hash.id if id.nil? && !entity_or_hash.id.nil?
|
|
29
|
-
|
|
28
|
+
elsif entity_or_hash.is_a?(Hash)
|
|
30
29
|
# If someone has passed in a hash, make sure all of it's values match fields in the entity class
|
|
31
30
|
data = sanitize(entity_or_hash)
|
|
32
31
|
else
|
|
@@ -67,7 +66,7 @@ module SBF
|
|
|
67
66
|
data.file = file
|
|
68
67
|
data
|
|
69
68
|
else
|
|
70
|
-
photo = SBF::Client::Photo.new(
|
|
69
|
+
photo = SBF::Client::Photo.new(data.is_a?(Hash) && data.any? ? data : {})
|
|
71
70
|
photo.file = file
|
|
72
71
|
photo
|
|
73
72
|
end
|
|
@@ -18,7 +18,7 @@ module SBF
|
|
|
18
18
|
# @option [Integer] :offset The query offset.
|
|
19
19
|
# @return [Client::Api::Response] The data attribute on a successful response will be
|
|
20
20
|
# an array of search entities matching the model type(s) specified
|
|
21
|
-
def find(model_type, search_text
|
|
21
|
+
def find(model_type, search_text = nil, filters = [], geo_location = {}, options = {})
|
|
22
22
|
if [search_text, filters, geo_location].all?(&:empty?)
|
|
23
23
|
raise SBF::Client::Error, 'Must provide either a search_text, filter or geo_location for the query'
|
|
24
24
|
end
|
|
@@ -45,7 +45,7 @@ module SBF
|
|
|
45
45
|
response_data[:total_count] = parsed_response_body[:total]
|
|
46
46
|
response_data[:results] = [].tap do |arr|
|
|
47
47
|
parsed_response_body[:hits].each do |entity_data|
|
|
48
|
-
arr << target_class.const_get(entity_data[:type].capitalize).new(entity_data[:source]
|
|
48
|
+
arr << target_class.const_get(entity_data[:type].capitalize).new(entity_data[:source])
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
|
|
@@ -20,7 +20,7 @@ module SBF
|
|
|
20
20
|
|
|
21
21
|
if ok?(response)
|
|
22
22
|
SBF::Client::Configuration.user_token = parsed_response[:token]
|
|
23
|
-
data = parsed_response.merge(user: target_class.new(parsed_response[:user]
|
|
23
|
+
data = parsed_response.merge(user: target_class.new(parsed_response[:user]))
|
|
24
24
|
else
|
|
25
25
|
SBF::Client::Configuration.user_token = nil
|
|
26
26
|
error = SBF::Client::ErrorEntity.new(parsed_response)
|
|
@@ -12,15 +12,17 @@ module SBF
|
|
|
12
12
|
PROCESSED = 'processed'.freeze
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
attr_accessor :id
|
|
16
|
-
|
|
15
|
+
attr_accessor :id
|
|
16
|
+
attr_accessor :type
|
|
17
17
|
multitype_attr_accessor(
|
|
18
18
|
:payment_details, [
|
|
19
19
|
[->(v) { v[:type] == SBF::Client::Payment::Type::CREDIT_CARD }, 'SBF::Client::Payment::CreditCardDetails'],
|
|
20
20
|
[->(v) { v[:type] == SBF::Client::Payment::Type::NONCE }, 'SBF::Client::Payment::NonceDetails']
|
|
21
21
|
]
|
|
22
22
|
)
|
|
23
|
-
|
|
23
|
+
attr_accessor :amount
|
|
24
|
+
attr_accessor :filename
|
|
25
|
+
attr_accessor :created_at, :modified_at, :processed_at, :submitted_by
|
|
24
26
|
entity_collection_attr_accessor :donations, 'SBF::Client::FullDonation', 'SBF::Client::PartialDonation'
|
|
25
27
|
end
|
|
26
28
|
end
|
|
@@ -12,7 +12,13 @@ module SBF
|
|
|
12
12
|
action :find_by_category
|
|
13
13
|
action :find_by_tag
|
|
14
14
|
|
|
15
|
-
attr_reader :id
|
|
15
|
+
attr_reader :id
|
|
16
|
+
attr_reader :slug
|
|
17
|
+
attr_reader :url
|
|
18
|
+
attr_reader :title
|
|
19
|
+
attr_reader :content
|
|
20
|
+
attr_reader :published_at
|
|
21
|
+
attr_reader :modified_at
|
|
16
22
|
end
|
|
17
23
|
end
|
|
18
24
|
end
|
|
@@ -12,8 +12,12 @@ module SBF
|
|
|
12
12
|
disallow_instantiation
|
|
13
13
|
|
|
14
14
|
class Totals < SBF::Client::BaseEntity
|
|
15
|
-
attr_reader :current_year_amount_raised
|
|
16
|
-
|
|
15
|
+
attr_reader :current_year_amount_raised
|
|
16
|
+
attr_reader :previous_year_amount_raised
|
|
17
|
+
attr_reader :all_years_amount_raised
|
|
18
|
+
attr_reader :participants
|
|
19
|
+
attr_reader :shavees
|
|
20
|
+
attr_reader :number_of_events
|
|
17
21
|
end
|
|
18
22
|
end
|
|
19
23
|
|
|
@@ -22,12 +26,15 @@ module SBF
|
|
|
22
26
|
end
|
|
23
27
|
|
|
24
28
|
class FullCampaign < Campaign
|
|
25
|
-
attr_accessor :id
|
|
29
|
+
attr_accessor :id
|
|
30
|
+
attr_accessor :name
|
|
31
|
+
attr_accessor :website_url
|
|
32
|
+
attr_accessor :is_enabled
|
|
26
33
|
|
|
27
|
-
entity_attr_reader :totals, 'SBF::Client::Campaign::Totals', nil,
|
|
28
|
-
entity_attr_accessor :web_page, 'SBF::Client::WebPage', nil,
|
|
34
|
+
entity_attr_reader :totals, 'SBF::Client::Campaign::Totals', nil, true
|
|
35
|
+
entity_attr_accessor :web_page, 'SBF::Client::WebPage', nil, true
|
|
29
36
|
|
|
30
|
-
entity_attr_accessor :photo, 'SBF::Client::Photo', nil,
|
|
37
|
+
entity_attr_accessor :photo, 'SBF::Client::Photo', nil, true
|
|
31
38
|
end
|
|
32
39
|
end
|
|
33
40
|
end
|
|
@@ -16,11 +16,13 @@ module SBF
|
|
|
16
16
|
DECLINED = 'declined'.freeze
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
attr_accessor :id
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
entity_attr_accessor :
|
|
19
|
+
attr_accessor :id
|
|
20
|
+
attr_accessor :status
|
|
21
|
+
attr_accessor :end_date
|
|
22
|
+
entity_attr_accessor :challenger, 'SBF::Client::Challenger', nil, true
|
|
23
|
+
entity_attr_accessor :challengee, 'SBF::Client::Challenger', nil, true
|
|
23
24
|
attr_reader :created_at, :modified_at
|
|
25
|
+
attr_accessor :modified_by
|
|
24
26
|
end
|
|
25
27
|
end
|
|
26
28
|
end
|
|
@@ -97,9 +97,11 @@ module SBF
|
|
|
97
97
|
end
|
|
98
98
|
end
|
|
99
99
|
|
|
100
|
-
attr_accessor :id
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
attr_accessor :id
|
|
101
|
+
attr_accessor :challenge_id
|
|
102
|
+
attr_accessor :type
|
|
103
|
+
attr_accessor :is_accepted
|
|
104
|
+
entity_attr_reader :totals, 'SBF::Client::Challenger::Totals', nil, true
|
|
103
105
|
|
|
104
106
|
multitype_attr_accessor(
|
|
105
107
|
:entity,
|
|
@@ -125,7 +127,7 @@ module SBF
|
|
|
125
127
|
'SBF::Client::Challenger::PartialEvent'
|
|
126
128
|
]
|
|
127
129
|
],
|
|
128
|
-
|
|
130
|
+
true
|
|
129
131
|
)
|
|
130
132
|
end
|
|
131
133
|
end
|
|
@@ -59,7 +59,7 @@ module EntityResponseConcern
|
|
|
59
59
|
caller_message = method_caller.nil? ? '' : " Called from #{method_caller.first}"
|
|
60
60
|
|
|
61
61
|
"[DEPRECATION] Use of the SBF::Client::Api::Response Interface (including the `#{method_name}` method) is deprecated"\
|
|
62
|
-
|
|
62
|
+
" for #{self.class}. Please update your code to use the #{self.class} interface accordingly. #{caller_message}"
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
65
|
end
|
|
@@ -11,9 +11,14 @@ module SBF
|
|
|
11
11
|
action :get
|
|
12
12
|
instance_action :reload
|
|
13
13
|
|
|
14
|
-
attr_reader :default_year
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
attr_reader :default_year
|
|
15
|
+
attr_reader :open_registration_years
|
|
16
|
+
attr_reader :website_url
|
|
17
|
+
attr_reader :years_for_squire
|
|
18
|
+
attr_reader :years_for_knight
|
|
19
|
+
attr_reader :years_for_knight_commander
|
|
20
|
+
attr_reader :years_for_crusader
|
|
21
|
+
attr_reader :years_for_baron
|
|
17
22
|
# NOTE: If you add another attribute, be sure to mock it out in `configure :test` of app.rb
|
|
18
23
|
|
|
19
24
|
# Attempts to call the method on the cached configuration object
|
|
@@ -14,19 +14,22 @@ module SBF
|
|
|
14
14
|
WEBSITE = 'website'.freeze
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
attr_reader :id
|
|
18
|
-
|
|
17
|
+
attr_reader :id
|
|
19
18
|
entity_attr_accessor :owner, 'SBF::Client::FullPerson', 'SBF::Client::PartialPerson'
|
|
20
19
|
entity_attr_accessor :person, 'SBF::Client::FullPerson', 'SBF::Client::PartialPerson'
|
|
21
20
|
attr_accessor :type
|
|
22
|
-
|
|
21
|
+
attr_reader :display_name
|
|
22
|
+
attr_reader :email
|
|
23
|
+
attr_reader :created_at, :modified_at
|
|
23
24
|
entity_collection_attr_reader :contact_groups, 'SBF::Client::ContactGroup'
|
|
24
25
|
end
|
|
25
26
|
|
|
26
27
|
class CustomContact < SBF::Client::Contact
|
|
27
28
|
endpoint SBF::Client::ContactEndpoint
|
|
28
29
|
|
|
29
|
-
attr_accessor :id
|
|
30
|
+
attr_accessor :id
|
|
31
|
+
attr_accessor :display_name
|
|
32
|
+
attr_accessor :email
|
|
30
33
|
end
|
|
31
34
|
end
|
|
32
35
|
end
|
|
@@ -8,8 +8,8 @@ module SBF
|
|
|
8
8
|
class ContactGroup < SBF::Client::TopLevelEntity
|
|
9
9
|
actions DEFAULT_CRUD_ACTIONS
|
|
10
10
|
|
|
11
|
-
attr_accessor :id
|
|
12
|
-
|
|
11
|
+
attr_accessor :id
|
|
12
|
+
attr_accessor :display_name
|
|
13
13
|
entity_attr_accessor :owner, 'SBF::Client::FullPerson'
|
|
14
14
|
multitype_collection_attr_accessor(
|
|
15
15
|
:contacts,
|
|
@@ -6,7 +6,12 @@ module SBF
|
|
|
6
6
|
action :get
|
|
7
7
|
action :find
|
|
8
8
|
|
|
9
|
-
attr_accessor :id
|
|
9
|
+
attr_accessor :id
|
|
10
|
+
attr_accessor :from_profile_id
|
|
11
|
+
attr_accessor :to_profile_id
|
|
12
|
+
attr_accessor :checkout_id
|
|
13
|
+
attr_accessor :change_history
|
|
14
|
+
attr_accessor :date_merged
|
|
10
15
|
end
|
|
11
16
|
end
|
|
12
17
|
end
|
|
@@ -27,10 +27,13 @@ module SBF
|
|
|
27
27
|
ERROR_OUT_OF_SYNC_UPDATE = 'error_out_of_sync_update'.freeze
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
attr_accessor :id
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
attr_accessor :id
|
|
31
|
+
attr_accessor :checkout_id
|
|
32
|
+
attr_accessor :status
|
|
33
|
+
attr_accessor :date_created
|
|
34
|
+
attr_accessor :date_modified
|
|
35
|
+
entity_collection_attr_accessor :persons, 'SBF::Client::FullPerson', nil, true
|
|
36
|
+
entity_collection_attr_accessor :organizations, 'SBF::Client::FullOrganization', nil, true
|
|
34
37
|
end
|
|
35
38
|
end
|
|
36
39
|
end
|
|
@@ -13,8 +13,11 @@ module SBF
|
|
|
13
13
|
|
|
14
14
|
disallow_instantiation
|
|
15
15
|
|
|
16
|
-
attr_accessor :id
|
|
17
|
-
|
|
16
|
+
attr_accessor :id
|
|
17
|
+
attr_accessor :name
|
|
18
|
+
attr_accessor :description
|
|
19
|
+
attr_reader :created_at
|
|
20
|
+
attr_reader :modified_at
|
|
18
21
|
end
|
|
19
22
|
end
|
|
20
23
|
end
|
|
@@ -6,9 +6,14 @@ module SBF
|
|
|
6
6
|
class DocumentLibrary < SBF::Client::TopLevelEntity
|
|
7
7
|
actions DEFAULT_CRUD_ACTIONS
|
|
8
8
|
|
|
9
|
-
attr_accessor :id
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
attr_accessor :id
|
|
10
|
+
attr_accessor :type
|
|
11
|
+
attr_accessor :title
|
|
12
|
+
attr_accessor :description
|
|
13
|
+
attr_accessor :url
|
|
14
|
+
attr_accessor :media_storage_id
|
|
15
|
+
attr_accessor :sort_order
|
|
16
|
+
entity_attr_reader :category, 'SBF::Client::DocumentLibraryCategory', nil, true
|
|
12
17
|
end
|
|
13
18
|
end
|
|
14
19
|
end
|