Class: Camdram::News
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#entity ⇒ Object
Returns the value of attribute entity.
-
#picture ⇒ Object
Returns the value of attribute picture.
-
#posted_at ⇒ Object
Returns the value of attribute posted_at.
-
#remote_id ⇒ Object
Returns the value of attribute remote_id.
-
#source ⇒ Object
Returns the value of attribute source.
Attributes included from API
Attributes inherited from Base
Instance Method Summary collapse
-
#info ⇒ Hash
Return a hash of the news item's attributes.
-
#initialize(options = {}) ⇒ Camdram::News
constructor
Instantiate a new News object from a JSON hash.
Methods included from API
Constructor Details
#initialize(options = {}) ⇒ Camdram::News
Instantiate a new News object from a JSON hash
15 16 17 18 19 20 21 |
# File 'lib/camdram/news.rb', line 15 def initialize( = {}) super() @entity = case @entity[:_type] when "society" then Organisation.new( @entity ) when "venue" then Venue.new( @entity ) end unless @entity.nil? end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
9 10 11 |
# File 'lib/camdram/news.rb', line 9 def body @body end |
#created_at ⇒ Object
Returns the value of attribute created_at.
9 10 11 |
# File 'lib/camdram/news.rb', line 9 def created_at @created_at end |
#entity ⇒ Object
Returns the value of attribute entity.
9 10 11 |
# File 'lib/camdram/news.rb', line 9 def entity @entity end |
#picture ⇒ Object
Returns the value of attribute picture.
9 10 11 |
# File 'lib/camdram/news.rb', line 9 def picture @picture end |
#posted_at ⇒ Object
Returns the value of attribute posted_at.
9 10 11 |
# File 'lib/camdram/news.rb', line 9 def posted_at @posted_at end |
#remote_id ⇒ Object
Returns the value of attribute remote_id.
9 10 11 |
# File 'lib/camdram/news.rb', line 9 def remote_id @remote_id end |
#source ⇒ Object
Returns the value of attribute source.
9 10 11 |
# File 'lib/camdram/news.rb', line 9 def source @source end |
Instance Method Details
#info ⇒ Hash
Return a hash of the news item's attributes
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/camdram/news.rb', line 26 def info { id: id, entity: entity, remote_id: remote_id, source: source, picture: picture, body: body, posted_at: posted_at, created_at: created_at, } end |