class Riksteatern::Production
Attributes
api_url[R]
categories[R]
data[R]
description[R]
first_performance_date[R]
first_performance_location[R]
homepage[R]
id[R]
intro_text[R]
name[R]
new_premiere_date[R]
new_premiere_location[R]
number_of_participants[R]
participants[R]
pause[R]
performance_length_hours[R]
performance_length_minutes[R]
pictures[R]
premiere_date[R]
premiere_location[R]
producer[R]
Public Class Methods
all(params = {})
click to toggle source
# File lib/riksteatern/production.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/production.rb, line 6 def find(id) data = get_data(productionId: id) new(data.first) if data.any? end
get_data(params = {})
click to toggle source
# File lib/riksteatern/production.rb, line 17 def get_data(params = {}) Riksteatern.api.productions(params) end
new(data)
click to toggle source
# File lib/riksteatern/production.rb, line 31 def initialize(data) @data = data.tap do |d| i = d['productionInformation'] || {} @api_url = d['productionUrl'] @id = Integer(@api_url.split('/').last) @name = i['productionName'] @intro_text = i['productionIntroText'] @description = i['productionDescription'] @homepage = i['productionHomepage'] @participants = i['participants'] @number_of_participants = i['numberOfParticipants'] @performance_length_hours = i['performanceLengthHrs'].to_i @performance_length_minutes = i['performanceLengthMns'].to_i @pause = i['pause'] @categories = i['category'] @pictures = i['productionPictures'] @first_performance_location = i['firstPerformanceLocation'] @first_performance_date = i['firstPerformanceDate'] @premiere_location = i['premiereLocation'] @premiere_date = i['premiereDate'] @new_premiere_location = i['newPremiereLoction'] @new_premiere_date = i['newPremiereDate'] @producer = Producer.new(d['producerInformation']) end end