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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6b06880d87b41ca451e513e1bac494a43a15105a05d52886c9366c82a01e11e
|
4
|
+
data.tar.gz: 05bef7f96bea609148ca0fc3bbc0fd7cca1de61a238c060a1f2bdac7a42491d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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: 12.2.
|
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:
|
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
|