Class: Fog::Compute::Packet::PaymentMethod
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Packet::PaymentMethod
- Defined in:
- lib/fog/compute/packet/models/payment_method.rb
Overview
PaymentMethod Model
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(attributes = {}) ⇒ PaymentMethod
constructor
A new instance of PaymentMethod.
- #save ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ PaymentMethod
Returns a new instance of PaymentMethod.
25 26 27 |
# File 'lib/fog/compute/packet/models/payment_method.rb', line 25 def initialize(attributes = {}) super end |
Instance Method Details
#destroy ⇒ Object
54 55 56 57 58 59 |
# 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 ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fog/compute/packet/models/payment_method.rb', line 29 def save requires :organization_id, :nonce, :name = { :name => name, :nonce => nonce } [:default] = default if default response = service.create_payment_method(organization_id, ) merge_attributes(response.body) end |
#update ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/fog/compute/packet/models/payment_method.rb', line 41 def update requires :id = {} [:name] = ["name"] if ["name"] [:cardholder_name] = ["cardholder_name"] if ["cardholder_name"] [:expiration_month] = ["expiration_month"] if ["expiration_month"] [:expiration_year] = ["expiration_year"] if ["expiration_year"] response = service.update_payment_method(id, ) merge_attributes(response.body) end |