Sha256: 8510d611fc1d944d2c5831f05193a924d25b45ff60cfe6597b549859593874e9

Contents?: true

Size: 648 Bytes

Versions: 1

Compression:

Stored size: 648 Bytes

Contents

module OptimizePlayer
  class Project < ApiObject
    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

    def id
      cid
    end

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
optimizeplayer-0.0.1 lib/optimize_player/project.rb