class Riksteatern::Event

Attributes

api_url[R]
arranger_id[R]
arranger_name[R]
cancelled[R]
co_producer[R]
data[R]
date[R]
id[R]
meta_description[R]
municipality_name[R]
name[R]
public_show[R]
region_name[R]
scenpass_benefit[R]
ticket_information[R]
ticket_information_online[R]
ticket_information_scenpass[R]
time[R]
venue_api_url[R]
venue_name[R]

Public Class Methods

all(params = {}) click to toggle source
# File lib/riksteatern/event.rb, line 11
def all(params = {})
  get_data(params).map { |c| new(c) }
end
Also aliased as: query
find(id) click to toggle source
# File lib/riksteatern/event.rb, line 6
def find(id)
  data = get_data(eventId: id)
  new(data.first) if data.any?
end
get_data(params = {}) click to toggle source
# File lib/riksteatern/event.rb, line 17
def get_data(params = {})
  Riksteatern.api.repertoires(params)
end
new(data) click to toggle source
# File lib/riksteatern/event.rb, line 29
def initialize(data)
  @data = data.tap do |d|
    i = d['eventInformation'] || {}

    @api_url       = d['eventUrl']
    @id            = @api_url.to_s.split('/').last.to_i
    @arranger_id   = d['arrangerId'].to_i
    @arranger_name = d['arrangerName']

    @name                        = i['eventName']
    @meta_description            = i['eventMetaDescription']
    @information_link            = i['informationLink']
    @venue_api_url               = i['venueUrl']
    @venue_name                  = i['venueName']
    @region_name                 = i['regionName']
    @municipality_name           = i['municipalityName']
    @date                        = i['eventDate']
    @time                        = i['eventTime']
    @ticket_information          = i['ticketInformation']
    @ticket_information_scenpass = i['ticketInformationScenpass']
    @ticket_information_online   = i['ticketInformationOnline']
    @scenpass_benefit            = i['scenpassBenefit']
    @public_show                 = i['publicShow']
    @co_producer                 = i['coProducer']
    @cancelled                   = i['cancelledEvent']
  end
end
query(params = {})
Alias for: all