class Camdram::Show

Attributes

author[RW]
category[RW]
description[RW]
image[RW]
name[RW]
online_booking_url[RW]
other_society[RW]
other_venue[RW]
performances[RW]
prices[RW]
slug[RW]
society[RW]
venue[RW]

Public Class Methods

new(options = {}) click to toggle source

Instantiate a new Show object from a JSON hash

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

Calls superclass method Camdram::API::new
# File lib/camdram/show.rb, line 18
def initialize(options = {})
  super(options)
  @society = Organisation.new( @society ) unless @society.nil?
  @venue = Venue.new( @venue ) unless @venue.nil?
  @performances = split_object( @performances, Performance ) unless @performances.nil?
  @image = Image.new( @image ) unless @image.nil?
end
url() click to toggle source

Returns the URL stub assocaited with all shows

@return [String] The URL stub.

# File lib/camdram/show.rb, line 67
def self.url
  '/shows'
end

Public Instance Methods

info() click to toggle source

Return a hash of the shows's attributes

@return [Hash] Hash with symbolized keys.

# File lib/camdram/show.rb, line 38
def info
  {
    id: id,
    name: name,
    description: description,
    image: image,
    slug: slug,
    author: author,
    prices: prices,
    other_venue: other_venue,
    other_society: other_society,
    category: category,
    performances: performances,
    online_booking_url: online_booking_url,
    society: society,
    venue: venue,
  }
end
roles() click to toggle source

Gets an array of roles associated with the shows

@return [Array] An array of Role objects.

# File lib/camdram/show.rb, line 29
def roles
  roles_url = "#{self.class.url}/#{slug}/roles.json"
  response = get(roles_url)
  split_object( response, Role )
end
url_slug() click to toggle source

Returns the URL+slug of the show

@return [String] The full URL and slug.

# File lib/camdram/show.rb, line 60
def url_slug
  "#{self.class.url}/#{slug}.json"
end