Class: OptimizePlayer::Account

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

Instance Attribute Summary

Attributes inherited from ApiObject

#context

Instance Method Summary collapse

Methods inherited from ApiObject

#[], #[]=, #add_accessors, #as_json, construct_from, #initialize, #inspect, #keys, #metaclass, #method_missing, #refresh, #refresh_from, #remove_accessors, #respond_to_missing?, #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

#delete(opts = {}) ⇒ Object Also known as: destroy



17
18
19
20
21
# File 'lib/optimize_player/account.rb', line 17

def delete(opts={})
  response = context.client.send_request(context.entity_name, :delete)
  refresh_from(response)
  self
end

#save(opts = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/optimize_player/account.rb', line 3

def save(opts={})
  attrs = {}
  @new_data.each do |n|
    attrs[n] = @data[n]
  end
  attrs = attrs.merge(opts)

  if attrs.any?
    response = context.client.send_request(context.entity_name, :patch, attrs)
    refresh_from(response)
  end
  self
end