Module: Smartcoin::ApiOperations::Update

Included in:
Charge, Customer, Plan, Subscription
Defined in:
lib/smartcoin/api_operations/update.rb

Instance Method Summary collapse

Instance Method Details

#saveObject



4
5
6
7
8
9
10
11
12
# File 'lib/smartcoin/api_operations/update.rb', line 4

def save
  params_to_update = {}
  self.serialize_params.each do |key|
    return if key.to_sym == :plan && ((@values[key] || @values[key.to_s]).is_a? Smartcoin::SmartcoinObject)
    params_to_update[key] = (@values[key] || @values[key.to_s]) if @values
  end

  update(params_to_update)
end

#update(params = nil, url_sufix = nil) ⇒ Object



14
15
16
17
18
# File 'lib/smartcoin/api_operations/update.rb', line 14

def update(params=nil, url_sufix=nil)
  method = :post
  response = api_request("#{url}/#{url_sufix}",method,params)
  reflesh_object(response)
end