Class: ShakeTheCounter::Performance

Inherits:
Object
  • Object
show all
Defined in:
lib/shake_the_counter/performance.rb

Overview

Sets up a performance object

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}, event: nil) ⇒ Performance

Sets up a new event



15
16
17
18
19
20
21
22
# File 'lib/shake_the_counter/performance.rb', line 15

def initialize(args={}, event: nil)
  self.key = args["PerformanceKey"]
  self.name = args["PerformanceName"]
  self.description = args["PerformanceDescription"]
  self.external_performance_id = args["ExternalPerformanceID"]
  self.raw_data = args
  self.event = event
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



8
9
10
# File 'lib/shake_the_counter/performance.rb', line 8

def description
  @description
end

#eventObject

Returns the value of attribute event.



11
12
13
# File 'lib/shake_the_counter/performance.rb', line 11

def event
  @event
end

#external_performance_idObject

Returns the value of attribute external_performance_id.



9
10
11
# File 'lib/shake_the_counter/performance.rb', line 9

def external_performance_id
  @external_performance_id
end

#keyObject

Returns the value of attribute key.



6
7
8
# File 'lib/shake_the_counter/performance.rb', line 6

def key
  @key
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/shake_the_counter/performance.rb', line 7

def name
  @name
end

#raw_dataObject

Returns the value of attribute raw_data.



10
11
12
# File 'lib/shake_the_counter/performance.rb', line 10

def raw_data
  @raw_data
end

Instance Method Details

#sectionsObject

GET /api/v1/event/eventKey/performance/performanceKey/sections/languageCode Get available sections, pricetypes and prices of the selected performance

Returns:

  • Array of sections



29
30
31
32
33
34
35
36
37
38
# File 'lib/shake_the_counter/performance.rb', line 29

def sections
  return @sections if @sections
  @sections = []
  path = "event/#{event.key}/performance/#{key}/sections/#{event.client.language_code}"
  result = event.client.call(path, http_method: :get)
  for section in result
    @sections << ShakeTheCounter::Section.new(section, performance: self)
  end
  return @sections
end