class Riksteatern::Venue

Attributes

accessibility[R]
acting_depth[R]
address[R]
api_url[R]
homepage[R]
id[R]
location[R]
name[R]
number_of_seats[R]
phone_numbers[R]
stage_depth[R]
stage_min_height[R]
stage_opening[R]
stage_width[R]
type[R]
type_id[R]

Public Class Methods

all(params = {}) click to toggle source
# File lib/riksteatern/venue.rb, line 15
def all(params = {})
  get_data(params).map { |c| new(c) }
end
Also aliased as: query
find(id) click to toggle source
# File lib/riksteatern/venue.rb, line 10
def find(id)
  data = get_data(venueId: id)
  new(data.first) if data.any?
end
get_data(params = {}) click to toggle source
# File lib/riksteatern/venue.rb, line 21
def get_data(params = {})
  Riksteatern.api.locations(params)
end
new(data) click to toggle source
# File lib/riksteatern/venue.rb, line 31
def initialize(data)
  @data = data.tap do |d|
    i = d['venueInformation'] || {}
    v = d['venueDescription'] || {}

    @api_url          = d['venueUrl']
    @name             = d['venueName']

    @type_id          = v['venueTypeId']
    @type             = v['venueType']
    @number_of_seats  = v['numberOfSeats']
    @stage_width      = v['stageWidth']
    @stage_depth      = v['stageDepth']
    @stage_opening    = v['stageOpening']
    @acting_depth     = v['actingDepth']
    @stage_min_height = v['stageMinHeight']

    @homepage         = i['homepage']
    @phone_numbers    = i['phoneNumber']

    @address          = Address.new(i['address'])
    @location         = Location.new(i['location'])
    @accessibility    = Accessibility.new(i['accesibility'])
  end
end
query(params = {})
Alias for: all