Class: Camdram::Show

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

Instance Attribute Summary collapse

Attributes inherited from Base

#id

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Refreshable

#refresh!

Methods inherited from Base

#make_orphan

Constructor Details

#initialize(*args) ⇒ Camdram::Show

Instantiate a new Show object from a JSON hash

Parameters:

  • options (Hash)

    A single JSON hash with symbolized keys.


20
21
22
23
24
25
# File 'lib/camdram/show.rb', line 20

def initialize(*args)
  super(*args)
  @societies = split_object(@societies, Society) unless @societies.nil?
  @performances = split_object(@performances, Performance) unless @performances.nil?
  @image = Image.new(@image, @client_instance) unless @image.nil?
end

Instance Attribute Details

#authorObject

Returns the value of attribute author.


14
15
16
# File 'lib/camdram/show.rb', line 14

def author
  @author
end

#categoryObject

Returns the value of attribute category.


14
15
16
# File 'lib/camdram/show.rb', line 14

def category
  @category
end

#descriptionObject

Returns the value of attribute description.


14
15
16
# File 'lib/camdram/show.rb', line 14

def description
  @description
end

#imageObject

Returns the value of attribute image.


14
15
16
# File 'lib/camdram/show.rb', line 14

def image
  @image
end

#nameObject

Returns the value of attribute name.


14
15
16
# File 'lib/camdram/show.rb', line 14

def name
  @name
end

#online_booking_urlObject

Returns the value of attribute online_booking_url.


14
15
16
# File 'lib/camdram/show.rb', line 14

def online_booking_url
  @online_booking_url
end

#performancesObject

Returns the value of attribute performances.


14
15
16
# File 'lib/camdram/show.rb', line 14

def performances
  @performances
end

#pricesObject

Returns the value of attribute prices.


14
15
16
# File 'lib/camdram/show.rb', line 14

def prices
  @prices
end

#slugObject

Returns the value of attribute slug.


14
15
16
# File 'lib/camdram/show.rb', line 14

def slug
  @slug
end

#societiesObject

Returns the value of attribute societies.


14
15
16
# File 'lib/camdram/show.rb', line 14

def societies
  @societies
end

#theme_colorObject

Returns the value of attribute theme_color.


14
15
16
# File 'lib/camdram/show.rb', line 14

def theme_color
  @theme_color
end

Class Method Details

.urlString

Returns the URL stub assocaited with all shows

Returns:

  • (String)

    The URL stub.


65
66
67
# File 'lib/camdram/show.rb', line 65

def self.url
  '/shows'
end

Instance Method Details

#infoHash

Return a hash of the shows's attributes

Returns:

  • (Hash)

    Hash with symbolized keys.


39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/camdram/show.rb', line 39

def info
  {
    id: id,
    name: name,
    description: description,
    image: image,
    slug: slug,
    author: author,
    prices: prices,
    category: category,
    performances: performances,
    online_booking_url: online_booking_url,
    societies: societies,
  }
end

#rolesArray

Gets an array of roles associated with the shows

Returns:

  • (Array)

    An array of Role objects.


30
31
32
33
34
# File 'lib/camdram/show.rb', line 30

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.


58
59
60
# File 'lib/camdram/show.rb', line 58

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