Class: Kentaa::Api::Resources::News
Instance Attribute Summary
Attributes inherited from Resource
#id
Attributes inherited from Base
#config, #endpoint_path, #options, #resource_class
Instance Method Summary
collapse
Methods inherited from Resource
#create, #created_at, #delete, #initialize, #load, #save, #updated_at
Methods inherited from Base
attribute_key, #initialize, #load, #loaded?
Instance Method Details
#content ⇒ Object
25
26
27
|
# File 'lib/kentaa/api/resources/news.rb', line 25
def content
data[:content]
end
|
#labels ⇒ Object
29
30
31
|
# File 'lib/kentaa/api/resources/news.rb', line 29
def labels
data[:labels]
end
|
#object_key ⇒ Object
9
10
11
|
# File 'lib/kentaa/api/resources/news.rb', line 9
def object_key
"News_#{id}"
end
|
#photos ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/kentaa/api/resources/news.rb', line 41
def photos
@photos ||= begin
photos = []
if data[:photos]
data[:photos].each do |photo|
photos << Kentaa::Api::Resources::Photo.new(photo)
end
end
photos
end
end
|
#public_id ⇒ Object
13
14
15
|
# File 'lib/kentaa/api/resources/news.rb', line 13
def public_id
data[:public_id]
end
|
#publish_at ⇒ Object
37
38
39
|
# File 'lib/kentaa/api/resources/news.rb', line 37
def publish_at
Time.parse(data[:publish_at]) if data[:publish_at]
end
|
#publish_state ⇒ Object
33
34
35
|
# File 'lib/kentaa/api/resources/news.rb', line 33
def publish_state
data[:publish_state]
end
|
#site ⇒ Object
17
18
19
|
# File 'lib/kentaa/api/resources/news.rb', line 17
def site
Kentaa::Api::Resources::Site.new(config, id: site_id, options: options)
end
|
#title ⇒ Object
21
22
23
|
# File 'lib/kentaa/api/resources/news.rb', line 21
def title
data[:title]
end
|
#videos ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/kentaa/api/resources/news.rb', line 55
def videos
@videos ||= begin
videos = []
if data[:videos]
data[:videos].each do |video|
videos << Kentaa::Api::Resources::Video.new(video)
end
end
videos
end
end
|