stbaldricks 4.7.0 → 4.8.0.alpha.1
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: aabe31bafa0d5933a0dc2556f335550fd5f74e9a
|
4
|
+
data.tar.gz: 702ec46de15476e2b42e609db42b190a0f5002a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14808a332d64ca87fa749216151ce681aa8e1e5f048fff1217ca4eaabdae153e060d337269e30ad62c6cdc377d09d8a45e37531fc11e113f606a91d57a02045e
|
7
|
+
data.tar.gz: 0ec05d698d5461c4a8dd9d2d9cc1c606b221b96af2d95bffc539eb7747c65786fb5f375ee73305a776f7e504ee2cf456fdb6983696017859b9f9698784414b51
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'stbaldricks/endpoints/lib/entity'
|
2
|
+
|
3
|
+
module SBF
|
4
|
+
module Client
|
5
|
+
class FundraiserEndpoint < EntityEndpoint
|
6
|
+
def join_team(fundraiser_id, new_team_id)
|
7
|
+
response = SBF::Client::Api::Request.post_request("#{base_uri}/move_to_different_team", id: fundraiser_id, new_team_id: new_team_id)
|
8
|
+
|
9
|
+
if ok?(response)
|
10
|
+
data = SBF::Client::FullFundraiser.new(JSON.parse(response.body).symbolize!)
|
11
|
+
else
|
12
|
+
error = SBF::Client::ErrorEntity.new(JSON.parse(response.body).symbolize!)
|
13
|
+
end
|
14
|
+
|
15
|
+
SBF::Client::Api::Response.new(http_code: response.code, data: data, error: error)
|
16
|
+
end
|
17
|
+
|
18
|
+
def start_team(fundraiser_id, team_name, fundraising_goal)
|
19
|
+
response = SBF::Client::Api::Request.post_request(
|
20
|
+
"#{base_uri}/move_to_different_team",
|
21
|
+
id: fundraiser_id,
|
22
|
+
new_team_id: 0,
|
23
|
+
team_name: team_name,
|
24
|
+
goal: fundraising_goal,
|
25
|
+
how_created: SBF::Client::Team::HowCreated::WEBSITE)
|
26
|
+
|
27
|
+
if ok?(response)
|
28
|
+
data = SBF::Client::FullFundraiser.new(JSON.parse(response.body).symbolize!)
|
29
|
+
else
|
30
|
+
error = SBF::Client::ErrorEntity.new(JSON.parse(response.body).symbolize!)
|
31
|
+
end
|
32
|
+
|
33
|
+
SBF::Client::Api::Response.new(http_code: response.code, data: data, error: error)
|
34
|
+
end
|
35
|
+
|
36
|
+
def leave_team(fundraiser_id)
|
37
|
+
join_team(fundraiser_id, 0)
|
38
|
+
end
|
39
|
+
|
40
|
+
def join_event(fundraiser_id, new_event_id)
|
41
|
+
response = SBF::Client::Api::Request.post_request("#{base_uri}/move_to_different_event",
|
42
|
+
id: fundraiser_id, new_event_id: new_event_id)
|
43
|
+
|
44
|
+
error = SBF::Client::ErrorEntity.new(JSON.parse(response.body).symbolize!) unless ok?(response)
|
45
|
+
|
46
|
+
SBF::Client::Api::Response.new(http_code: response.code, data: nil, error: error)
|
47
|
+
end
|
48
|
+
|
49
|
+
def leave_event(fundraiser_id)
|
50
|
+
join_event(fundraiser_id, 0)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'stbaldricks/entities/lib/top_level'
|
2
|
+
require 'stbaldricks/endpoints/fundraiser'
|
2
3
|
require 'stbaldricks/entities/person'
|
3
4
|
require 'stbaldricks/entities/fund'
|
4
5
|
require 'stbaldricks/entities/event'
|
@@ -18,7 +19,13 @@ module SBF
|
|
18
19
|
include EventYearConcern
|
19
20
|
include FundraisingPageConcern
|
20
21
|
include VenueConcern
|
22
|
+
endpoint SBF::Client::FundraiserEndpoint
|
21
23
|
actions DEFAULT_CRUD_ACTIONS
|
24
|
+
action :join_team
|
25
|
+
action :start_team
|
26
|
+
action :leave_team
|
27
|
+
action :join_event
|
28
|
+
action :leave_event
|
22
29
|
|
23
30
|
disallow_instantiation
|
24
31
|
|
@@ -138,6 +145,8 @@ module SBF
|
|
138
145
|
def past?
|
139
146
|
return Date.today > Date.parse(end_date) if end_date
|
140
147
|
Date.today > Date.parse(start_date) if start_date
|
148
|
+
rescue
|
149
|
+
nil
|
141
150
|
end
|
142
151
|
end
|
143
152
|
end
|
data/lib/stbaldricks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stbaldricks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.8.0.alpha.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Firespring
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- lib/stbaldricks/endpoints/event.rb
|
87
87
|
- lib/stbaldricks/endpoints/facebook/user.rb
|
88
88
|
- lib/stbaldricks/endpoints/fund.rb
|
89
|
+
- lib/stbaldricks/endpoints/fundraiser.rb
|
89
90
|
- lib/stbaldricks/endpoints/kid.rb
|
90
91
|
- lib/stbaldricks/endpoints/kid_honor.rb
|
91
92
|
- lib/stbaldricks/endpoints/lib/entity.rb
|
@@ -220,12 +221,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
220
221
|
version: '0'
|
221
222
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
222
223
|
requirements:
|
223
|
-
- - "
|
224
|
+
- - ">"
|
224
225
|
- !ruby/object:Gem::Version
|
225
|
-
version:
|
226
|
+
version: 1.3.1
|
226
227
|
requirements: []
|
227
228
|
rubyforge_project:
|
228
|
-
rubygems_version: 2.
|
229
|
+
rubygems_version: 2.6.13
|
229
230
|
signing_key:
|
230
231
|
specification_version: 4
|
231
232
|
summary: St. Baldrick's Foundation Ruby Client Library
|