Class: Kentaa::Api::Resources::Performance

Inherits:
Resource show all
Defined in:
lib/kentaa/api/resources/performance.rb

Instance Attribute Summary

Attributes inherited from Resource

#id

Attributes inherited from Base

#config, #endpoint_path, #options, #resource_class

Instance Method Summary collapse

Methods inherited from Resource

#create, #created_at, #delete, #initialize, #load, #save, #updated_at

Methods inherited from Base

attribute_key, #initialize, #load, #loaded?

Constructor Details

This class inherits a constructor from Kentaa::Api::Resources::Resource

Instance Method Details

#actionObject



18
19
20
# File 'lib/kentaa/api/resources/performance.rb', line 18

def action
  Kentaa::Api::Resources::Action.new(config, id: action_id, options: options)
end

#action_idObject



14
15
16
# File 'lib/kentaa/api/resources/performance.rb', line 14

def action_id
  data[:action_id]
end

#descriptionObject



26
27
28
# File 'lib/kentaa/api/resources/performance.rb', line 26

def description
  data[:description]
end

#distanceObject



38
39
40
# File 'lib/kentaa/api/resources/performance.rb', line 38

def distance
  BigDecimal(data[:distance])
end

#object_keyObject



10
11
12
# File 'lib/kentaa/api/resources/performance.rb', line 10

def object_key
  "ActionPerformance_#{id}"
end

#performance_atObject



34
35
36
# File 'lib/kentaa/api/resources/performance.rb', line 34

def performance_at
  Time.parse(data[:performance_at])
end

#performance_typeObject



30
31
32
# File 'lib/kentaa/api/resources/performance.rb', line 30

def performance_type
  data[:performance_type]
end

#photos(options = {}) ⇒ Object



46
47
48
# File 'lib/kentaa/api/resources/performance.rb', line 46

def photos(options = {})
  @photos ||= Kentaa::Api::Resources::List.new(config, options.merge(resource_class: Kentaa::Api::Resources::PerformancePhoto, endpoint_path: "/actions/#{action_id}/performances/#{id}/photos"))
end

#titleObject



22
23
24
# File 'lib/kentaa/api/resources/performance.rb', line 22

def title
  data[:title]
end

#unitObject



42
43
44
# File 'lib/kentaa/api/resources/performance.rb', line 42

def unit
  data[:unit]
end