Class: OptimizePlayer::Project

Inherits:
ApiObject show all
Defined in:
lib/optimize_player/project.rb

Instance Attribute Summary

Attributes inherited from ApiObject

#context

Instance Method Summary collapse

Methods inherited from ApiObject

#[], #[]=, #add_accessors, #as_json, construct_from, #delete, #initialize, #keys, #metaclass, #method_missing, #refresh, #refresh_from, #remove_accessors, #respond_to_missing?, #save, #to_hash, #to_json, #values

Constructor Details

This class inherits a constructor from OptimizePlayer::ApiObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class OptimizePlayer::ApiObject

Instance Method Details

#idObject



8
9
10
# File 'lib/optimize_player/project.rb', line 8

def id
  cid
end

#inspectObject



3
4
5
6
# File 'lib/optimize_player/project.rb', line 3

def inspect()
  cid_string = (self.respond_to?(:cid) && !self.cid.nil?) ? " cid=#{self.cid}" : ""
  "#<#{self.class}:0x#{self.object_id.to_s(16)}#{cid_string}> JSON: " + JSON.pretty_generate(@data)
end

#set_position(position) ⇒ Object



12
13
14
15
16
# File 'lib/optimize_player/project.rb', line 12

def set_position(position)
  response = context.client.send_request("projects/#{id}/set_position", :put, position: position)
  refresh_from(response)
  self
end

#toggle_favoriteObject



18
19
20
21
22
# File 'lib/optimize_player/project.rb', line 18

def toggle_favorite
  response = context.client.send_request("projects/#{id}/toggle_favorite", :put)
  refresh_from(response)
  self
end