Class: Conekta::Order
- Inherits:
-
Resource
- Object
- Hash
- ConektaObject
- Resource
- Conekta::Order
- Includes:
- Conekta::Operations::Create, Conekta::Operations::CreateMember, Conekta::Operations::CustomAction, Conekta::Operations::Find, Conekta::Operations::Update, Conekta::Operations::Where
- Defined in:
- lib/conekta/order.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#charges ⇒ Object
Returns the value of attribute charges.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#customer_id ⇒ Object
Returns the value of attribute customer_id.
-
#discount_lines ⇒ Object
Returns the value of attribute discount_lines.
-
#line_items ⇒ Object
Returns the value of attribute line_items.
-
#livemode ⇒ Object
Returns the value of attribute livemode.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#payment_status ⇒ Object
Returns the value of attribute payment_status.
-
#shipping_contact ⇒ Object
Returns the value of attribute shipping_contact.
-
#shipping_lines ⇒ Object
Returns the value of attribute shipping_lines.
-
#tax_lines ⇒ Object
Returns the value of attribute tax_lines.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Attributes inherited from Resource
Attributes inherited from ConektaObject
Instance Method Summary collapse
-
#authorize_capture(params = {}) ⇒ Object
State transitions.
- #create_charge(params) ⇒ Object
- #create_discount_line(params) ⇒ Object
-
#create_line_item(params) ⇒ Object
Attribute accessors.
- #create_shipping_contact(params) ⇒ Object
- #create_shipping_line(params) ⇒ Object
- #create_tax_line(params) ⇒ Object
-
#initialize(id = nil) ⇒ Order
constructor
A new instance of Order.
- #load_from(response = nil) ⇒ Object
- #refund(params = {}) ⇒ Object
- #void(params = {}) ⇒ Object
Methods included from Conekta::Operations::CustomAction
Methods included from Conekta::Operations::CreateMember
Methods included from Conekta::Operations::Update
Methods included from Conekta::Operations::Create
Methods included from Conekta::Operations::Where
handle_type_of_paging, included
Methods included from Conekta::Operations::Find
Methods inherited from Resource
_url, #_url, #create_member_with_relation, underscored_class
Methods inherited from ConektaObject
#class_name, class_name, #create_attr, #first, #inspect, #last, #set_val, #to_s, #unset_key
Constructor Details
#initialize(id = nil) ⇒ Order
Returns a new instance of Order.
14 15 16 17 18 19 20 21 22 |
# File 'lib/conekta/order.rb', line 14 def initialize(id=nil) @id = id @line_items ||= List.new("LineItem", {}) @tax_lines ||= List.new("TaxLine", {}) @shipping_lines ||= List.new("ShippingLine", {}) @discount_lines ||= List.new("DiscountLine", {}) @charges ||= List.new("Charge", {}) super(id) end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
10 11 12 |
# File 'lib/conekta/order.rb', line 10 def amount @amount end |
#charges ⇒ Object
Returns the value of attribute charges.
10 11 12 |
# File 'lib/conekta/order.rb', line 10 def charges @charges end |
#created_at ⇒ Object
Returns the value of attribute created_at.
10 11 12 |
# File 'lib/conekta/order.rb', line 10 def created_at @created_at end |
#currency ⇒ Object
Returns the value of attribute currency.
10 11 12 |
# File 'lib/conekta/order.rb', line 10 def currency @currency end |
#customer_id ⇒ Object
Returns the value of attribute customer_id.
10 11 12 |
# File 'lib/conekta/order.rb', line 10 def customer_id @customer_id end |
#discount_lines ⇒ Object
Returns the value of attribute discount_lines.
10 11 12 |
# File 'lib/conekta/order.rb', line 10 def discount_lines @discount_lines end |
#line_items ⇒ Object
Returns the value of attribute line_items.
10 11 12 |
# File 'lib/conekta/order.rb', line 10 def line_items @line_items end |
#livemode ⇒ Object
Returns the value of attribute livemode.
10 11 12 |
# File 'lib/conekta/order.rb', line 10 def livemode @livemode end |
#metadata ⇒ Object
Returns the value of attribute metadata.
10 11 12 |
# File 'lib/conekta/order.rb', line 10 def @metadata end |
#payment_status ⇒ Object
Returns the value of attribute payment_status.
10 11 12 |
# File 'lib/conekta/order.rb', line 10 def payment_status @payment_status end |
#shipping_contact ⇒ Object
Returns the value of attribute shipping_contact.
10 11 12 |
# File 'lib/conekta/order.rb', line 10 def shipping_contact @shipping_contact end |
#shipping_lines ⇒ Object
Returns the value of attribute shipping_lines.
10 11 12 |
# File 'lib/conekta/order.rb', line 10 def shipping_lines @shipping_lines end |
#tax_lines ⇒ Object
Returns the value of attribute tax_lines.
10 11 12 |
# File 'lib/conekta/order.rb', line 10 def tax_lines @tax_lines end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
10 11 12 |
# File 'lib/conekta/order.rb', line 10 def updated_at @updated_at end |
Instance Method Details
#authorize_capture(params = {}) ⇒ Object
State transitions
61 62 63 |
# File 'lib/conekta/order.rb', line 61 def (params={}) custom_action(:post, 'capture', params) end |
#create_charge(params) ⇒ Object
52 53 54 |
# File 'lib/conekta/order.rb', line 52 def create_charge(params) self.create_member('charges', params) end |
#create_discount_line(params) ⇒ Object
48 49 50 |
# File 'lib/conekta/order.rb', line 48 def create_discount_line(params) self.create_member_with_relation('discount_lines', params, self) end |
#create_line_item(params) ⇒ Object
Attribute accessors
36 37 38 |
# File 'lib/conekta/order.rb', line 36 def create_line_item(params) self.create_member_with_relation('line_items', params, self) end |
#create_shipping_contact(params) ⇒ Object
56 57 58 |
# File 'lib/conekta/order.rb', line 56 def create_shipping_contact(params) self.update(shipping_contact: params).shipping_contact end |
#create_shipping_line(params) ⇒ Object
44 45 46 |
# File 'lib/conekta/order.rb', line 44 def create_shipping_line(params) self.create_member_with_relation('shipping_lines', params, self) end |
#create_tax_line(params) ⇒ Object
40 41 42 |
# File 'lib/conekta/order.rb', line 40 def create_tax_line(params) self.create_member_with_relation('tax_lines', params, self) end |
#load_from(response = nil) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/conekta/order.rb', line 24 def load_from(response = nil) if response super end order = self submodels = [:line_items, :tax_lines, :shipping_lines, :discount_lines, :charges] create_submodels_lists(order, submodels) end |
#refund(params = {}) ⇒ Object
69 70 71 |
# File 'lib/conekta/order.rb', line 69 def refund(params={}) custom_action(:post, 'refund', params) end |
#void(params = {}) ⇒ Object
65 66 67 |
# File 'lib/conekta/order.rb', line 65 def void(params={}) custom_action(:post, 'void', params) end |