class Camdram::News

Attributes

body[RW]
created_at[RW]
entity[RW]
picture[RW]
posted_at[RW]
remote_id[RW]
source[RW]

Public Class Methods

new(options = {}) click to toggle source

Instantiate a new News object from a JSON hash

@param options [Hash] A single JSON hash with symbolized keys. @return [Camdram::News] The new News object.

Calls superclass method Camdram::API::new
# File lib/camdram/news.rb, line 15
def initialize(options = {})
  super(options)
  @entity = case @entity[:_type]
    when "society" then Organisation.new( @entity )
    when "venue" then Venue.new( @entity )
  end unless @entity.nil?
end

Public Instance Methods

info() click to toggle source

Return a hash of the news item's attributes

@return [Hash] Hash with symbolized keys.

# 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