stbaldricks 4.7.0 → 4.8.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 4696ffab3e481d8780274662328d88951aa91b5b7aba7310c3fc42869dc09fc4
4
- data.tar.gz: 299ef8f125f0f91960254a5e48182818312515b2e265af5eab1af5f990efd233
2
+ SHA1:
3
+ metadata.gz: aabe31bafa0d5933a0dc2556f335550fd5f74e9a
4
+ data.tar.gz: 702ec46de15476e2b42e609db42b190a0f5002a3
5
5
  SHA512:
6
- metadata.gz: 5dc7703a2a060a6e81ef2f9f513454b94371200d4ecf39682a7571c389c937e5b5fdd7a25a2b3a78ab8859eba8314acdfa465c6cf257c6e29dda48dcf67a2a57
7
- data.tar.gz: 7c4fed18cdf6c03f2f99a84bed8d004cda518a6939dd7a93dccf938f594be4feb4a6d1ce0b1f33ba825f8df3aaa61e9d949c946225495150bc58129064e02d89
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
@@ -203,6 +203,12 @@ module SBF
203
203
  def open_for_fast_registration?
204
204
  is_open_for_fast_registration
205
205
  end
206
+
207
+ def past?
208
+ Date.today > Date.parse(date)
209
+ rescue
210
+ nil
211
+ end
206
212
  end
207
213
  end
208
214
  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
@@ -1,5 +1,5 @@
1
1
  module SBF
2
2
  module Client
3
- VERSION = '4.7.0'
3
+ VERSION = '4.8.0.alpha.1'
4
4
  end
5
5
  end
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.7.0
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-09 00:00:00.000000000 Z
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: '0'
226
+ version: 1.3.1
226
227
  requirements: []
227
228
  rubyforge_project:
228
- rubygems_version: 2.7.5
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