class Fog::Compute::Packet::PaymentMethod

PaymentMethod Model

Public Class Methods

new(attributes = {}) click to toggle source
Calls superclass method
# File lib/fog/compute/packet/models/payment_method.rb, line 25
def initialize(attributes = {})
  super
end

Public Instance Methods

destroy() click to toggle source
# File lib/fog/compute/packet/models/payment_method.rb, line 54
def destroy
  requires :id

  response = service.delete_payment_method(id)
  true if response.status == 204
end
save() click to toggle source
# File lib/fog/compute/packet/models/payment_method.rb, line 29
def save
  requires :organization_id, :nonce, :name
  options = {
    :name => name,
    :nonce => nonce
  }
  options[:default] = default if default
  response = service.create_payment_method(organization_id, options)

  merge_attributes(response.body)
end
update() click to toggle source
# File lib/fog/compute/packet/models/payment_method.rb, line 41
def update
  requires :id
  options = {}
  options[:name] = options["name"] if options["name"]
  options[:cardholder_name] = options["cardholder_name"] if options["cardholder_name"]
  options[:expiration_month] = options["expiration_month"] if options["expiration_month"]
  options[:expiration_year] = options["expiration_year"] if options["expiration_year"]

  response = service.update_payment_method(id, options)

  merge_attributes(response.body)
end