Class: Camdram::Show

Inherits:
Base
  • Object
show all
Includes:
API
Defined in:
lib/camdram/show.rb

Instance Attribute Summary collapse

Attributes included from API

#http

Attributes inherited from Base

#id

Class Method Summary collapse

Instance Method Summary collapse

Methods included from API

#update!

Constructor Details

#initialize(options = {}) ⇒ Camdram::Show

Instantiate a new Show object from a JSON hash

Parameters:

  • options (Hash) (defaults to: {})

    A single JSON hash with symbolized keys.



18
19
20
21
22
23
24
# 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

Instance Attribute Details

#authorObject

Returns the value of attribute author.



12
13
14
# File 'lib/camdram/show.rb', line 12

def author
  @author
end

#categoryObject

Returns the value of attribute category.



12
13
14
# File 'lib/camdram/show.rb', line 12

def category
  @category
end

#descriptionObject

Returns the value of attribute description.



12
13
14
# File 'lib/camdram/show.rb', line 12

def description
  @description
end

#imageObject

Returns the value of attribute image.



12
13
14
# File 'lib/camdram/show.rb', line 12

def image
  @image
end

#nameObject

Returns the value of attribute name.



12
13
14
# File 'lib/camdram/show.rb', line 12

def name
  @name
end

#online_booking_urlObject

Returns the value of attribute online_booking_url.



12
13
14
# File 'lib/camdram/show.rb', line 12

def online_booking_url
  @online_booking_url
end

#other_societyObject

Returns the value of attribute other_society.



12
13
14
# File 'lib/camdram/show.rb', line 12

def other_society
  @other_society
end

#other_venueObject

Returns the value of attribute other_venue.



12
13
14
# File 'lib/camdram/show.rb', line 12

def other_venue
  @other_venue
end

#performancesObject

Returns the value of attribute performances.



12
13
14
# File 'lib/camdram/show.rb', line 12

def performances
  @performances
end

#pricesObject

Returns the value of attribute prices.



12
13
14
# File 'lib/camdram/show.rb', line 12

def prices
  @prices
end

#slugObject

Returns the value of attribute slug.



12
13
14
# File 'lib/camdram/show.rb', line 12

def slug
  @slug
end

#societyObject

Returns the value of attribute society.



12
13
14
# File 'lib/camdram/show.rb', line 12

def society
  @society
end

#venueObject

Returns the value of attribute venue.



12
13
14
# File 'lib/camdram/show.rb', line 12

def venue
  @venue
end

Class Method Details

.urlString

Returns the URL stub assocaited with all shows

Returns:

  • (String)

    The URL stub.



67
68
69
# File 'lib/camdram/show.rb', line 67

def self.url
  '/shows'
end

Instance Method Details

#infoHash

Return a hash of the shows's attributes

Returns:

  • (Hash)

    Hash with symbolized keys.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# 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

#rolesArray

Gets an array of roles associated with the shows

Returns:

  • (Array)

    An array of Role objects.



29
30
31
32
33
# 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_slugString

Returns the URL+slug of the show

Returns:

  • (String)

    The full URL and slug.



60
61
62
# File 'lib/camdram/show.rb', line 60

def url_slug
  "#{self.class.url}/#{slug}.json"
end