Class: Ey::Core::Client::Billing

Inherits:
Model
  • Object
show all
Defined in:
lib/ey-core/models/billing.rb

Instance Method Summary collapse

Methods inherited from Model

#destroy, range_parser, #save, #to_s, #update!, #url

Instance Method Details

#get(params) ⇒ Object



24
25
26
# File 'lib/ey-core/models/billing.rb', line 24

def get(params)
  merge_attributes(connection.get_billing(params).body["billing"])
end

#new(attributes = {}) ⇒ Object



5
6
7
# File 'lib/ey-core/models/billing.rb', line 5

def new(attributes = {})
  self.class.new(attributes.merge(:connection => self.connection))
end

#put_state(id, state) ⇒ Object



9
10
11
12
13
14
# File 'lib/ey-core/models/billing.rb', line 9

def put_state(id, state)
  b = self.class.new(:connection => self.connection)
  b.id = id
  b.state = state
  b.save!
end

#save!Object



16
17
18
19
20
21
22
# File 'lib/ey-core/models/billing.rb', line 16

def save!
  params = {
    "id"    => self.id,
    "state" => self.state
  }
  merge_attributes(self.connection.update_billing(params).body["billing"])
end