stbaldricks 12.2.0.alpha.1 → 12.2.2.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
2
  SHA256:
3
- metadata.gz: e19467bf8d5a65dda7a55938e3fd38b1d6d0ea95e8c62e7da5e707dbcfef7058
4
- data.tar.gz: 3ee4829e15f7c0ccea055f00cf332c7528df56c0ada3a10a02352cde5f9c1d92
3
+ metadata.gz: b6b06880d87b41ca451e513e1bac494a43a15105a05d52886c9366c82a01e11e
4
+ data.tar.gz: 05bef7f96bea609148ca0fc3bbc0fd7cca1de61a238c060a1f2bdac7a42491d7
5
5
  SHA512:
6
- metadata.gz: 5177d7b89e0e91d324f2dc0f7969706e55f7a53522022b410cdf885a0dc9848b032cfe07330bdb41fb112aa24130ba7a30f7281ef75446c123a426ecf9434db1
7
- data.tar.gz: bc14438f679c7b871706acb047a04cd1c7984b3718934aefef0f25aef4856be8aa2251ad1748ed54483bf1117d0f714678ddf13f84991330e2dbc28f3f2e2358
6
+ metadata.gz: f3bd0496ffe9f98050bd49a8ac7c03fbbc5d139d472894359cdb6d499a9d182099525f69d899b0e6e63afdb959629075e24a2ead98b2a9d37be80ec47c9255ff
7
+ data.tar.gz: d5226ae54647c5006877663560dbdd2834e0a0cbb1f6324580635d53063e0f917a07a988bb1e5dc529bc842dd949c061b292a5ca152460b0d6f018f6c8e57596
@@ -0,0 +1,74 @@
1
+ require 'stbaldricks/api'
2
+ require 'stbaldricks/endpoints/lib/entity'
3
+
4
+ module SBF
5
+ module Client
6
+ class BlogPostEndpoint < SBF::Client::EntityEndpoint
7
+ FILTER_BY_AUTHOR = 'author'.freeze
8
+ FILTER_BY_CATEGORY = 'category'.freeze
9
+ FILTER_BY_TERM = 'filter_term'.freeze
10
+ FILTER_BY_TAG = 'tag'.freeze
11
+
12
+ def base_uri
13
+ "/#{SBF::Client::Api::VERSION}/blog_post"
14
+ end
15
+
16
+ def get(slug)
17
+ response = SBF::Client::Api::Request.get_request("#{base_uri}/get/#{slug}")
18
+
19
+ if ok?(response)
20
+ hydrated_entity(response, {}, nil)
21
+ elsif response.code == 404
22
+ nil
23
+ else
24
+ parsed_response_body = JSON.parse(response.body).symbolize!
25
+ error = SBF::Client::ErrorEntity.new(parsed_response_body)
26
+ SBF::Client::Api::Response.new(http_code: response.code, data: parsed_response_body[:data], error: error)
27
+ end
28
+ end
29
+
30
+ def find_by_term(term, order = {}, limit = 10, offset = 0, show_hidden = true)
31
+ # Build the parameter list for search; an empty find is supported
32
+ filter = {}
33
+ filter[:type] = FILTER_BY_TERM
34
+ filter[:term] = term unless term.empty?
35
+ filter[:show_hidden] = show_hidden
36
+
37
+ find(filter, order, limit, offset)
38
+ end
39
+
40
+ def find_by_author(author, order = {}, limit = 10, offset = 0, show_hidden = true)
41
+ raise SBF::Client::Error, 'Must provide author for the query' if author.empty?
42
+
43
+ filter = {}
44
+ filter[:type] = FILTER_BY_AUTHOR
45
+ filter[:term] = author
46
+ filter[:show_hidden] = show_hidden
47
+
48
+ find(filter, order, limit, offset)
49
+ end
50
+
51
+ def find_by_category(category, order = {}, limit = 10, offset = 0, show_hidden = true)
52
+ raise SBF::Client::Error, 'Must provide category for the query' if category.empty?
53
+
54
+ filter = {}
55
+ filter[:type] = FILTER_BY_CATEGORY
56
+ filter[:term] = category
57
+ filter[:show_hidden] = show_hidden
58
+
59
+ find(filter, order, limit, offset)
60
+ end
61
+
62
+ def find_by_tag(tag, order = {}, limit = 10, offset = 0, show_hidden = true)
63
+ raise SBF::Client::Error, 'Must provide tag for the query' if tag.empty?
64
+
65
+ filter = {}
66
+ filter[:type] = FILTER_BY_TAG
67
+ filter[:term] = tag
68
+ filter[:show_hidden] = show_hidden
69
+
70
+ find(filter, order, limit, offset)
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,25 @@
1
+ require 'stbaldricks/endpoints/blog_post'
2
+ require 'stbaldricks/entities/lib/top_level'
3
+
4
+ module SBF
5
+ module Client
6
+ module Blog
7
+ class Post < SBF::Client::TopLevelEntity
8
+ endpoint SBF::Client::BlogPostEndpoint
9
+ action :get
10
+ action :find_by_term
11
+ action :find_by_author
12
+ action :find_by_category
13
+ action :find_by_tag
14
+
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
22
+ end
23
+ end
24
+ end
25
+ end
@@ -10,6 +10,7 @@ module SBF
10
10
  attr_accessor :amount
11
11
  attr_accessor :count
12
12
  attr_accessor :donation_created_at
13
+ attr_accessor :donation_collected_at
13
14
  end
14
15
  end
15
16
  end
@@ -10,6 +10,7 @@ module SBF
10
10
  FIRE_DEPARTMENT = 'fire_department'
11
11
  POLICE_DEPARTMENT = 'police_department'
12
12
  FIRE_AND_POLICE = 'fire_and_police'
13
+ SERVICE_ORGANIZATION = 'service_organization'
13
14
  end
14
15
  end
15
16
  end
@@ -1,5 +1,5 @@
1
1
  module SBF
2
2
  module Client
3
- VERSION = '12.2.0.alpha.1'.freeze
3
+ VERSION = '12.2.2.alpha.1'.freeze
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: 12.2.0.alpha.1
4
+ version: 12.2.2.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: 2021-12-06 00:00:00.000000000 Z
11
+ date: 2022-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -304,6 +304,7 @@ files:
304
304
  - lib/stbaldricks/client.rb
305
305
  - lib/stbaldricks/configuration.rb
306
306
  - lib/stbaldricks/default_logger.rb
307
+ - lib/stbaldricks/endpoints/blog_post.rb
307
308
  - lib/stbaldricks/endpoints/communicate.rb
308
309
  - lib/stbaldricks/endpoints/config.rb
309
310
  - lib/stbaldricks/endpoints/contact.rb
@@ -327,6 +328,7 @@ files:
327
328
  - lib/stbaldricks/endpoints/shave_schedule.rb
328
329
  - lib/stbaldricks/endpoints/user.rb
329
330
  - lib/stbaldricks/entities/batch.rb
331
+ - lib/stbaldricks/entities/blog_post.rb
330
332
  - lib/stbaldricks/entities/campaign.rb
331
333
  - lib/stbaldricks/entities/challenge.rb
332
334
  - lib/stbaldricks/entities/challenger.rb