Class: OptimizePlayer::Proxies::BaseProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/optimize_player/proxies/base_proxy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ BaseProxy

Returns a new instance of BaseProxy.



6
7
8
# File 'lib/optimize_player/proxies/base_proxy.rb', line 6

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



4
5
6
# File 'lib/optimize_player/proxies/base_proxy.rb', line 4

def client
  @client
end

Instance Method Details

#all(attrs = {}) ⇒ Object



14
15
16
17
# File 'lib/optimize_player/proxies/base_proxy.rb', line 14

def all(attrs={})
  response = client.send_request(entity_name, :get, attrs)
  Converter.convert_to_object(self, response)
end

#create(attrs) ⇒ Object



24
25
26
27
# File 'lib/optimize_player/proxies/base_proxy.rb', line 24

def create(attrs)
  response = client.send_request(entity_name, :post, attrs)
  Converter.convert_to_object(self, response)
end

#find(id) ⇒ Object



19
20
21
22
# File 'lib/optimize_player/proxies/base_proxy.rb', line 19

def find(id)
  response = client.send_request("#{entity_name}/#{id}", :get)
  Converter.convert_to_object(self, response)
end

#inspectObject



10
11
12
# File 'lib/optimize_player/proxies/base_proxy.rb', line 10

def inspect()
  "#<#{self.class}:0x#{self.object_id.to_s(16)}"
end