Class: Moip2::Resource::Order

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/moip2/resource/order.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, response) ⇒ Order

Returns a new instance of Order.



8
9
10
11
12
13
14
15
16
# File 'lib/moip2/resource/order.rb', line 8

def initialize(client, response)
  super(response)
  @client = client

  if response.respond_to?(:external_id)
    @payment_api = PaymentApi.new(client)
    @external_id = response.external_id
  end
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



6
7
8
# File 'lib/moip2/resource/order.rb', line 6

def client
  @client
end

#external_idObject (readonly)

Returns the value of attribute external_id.



6
7
8
# File 'lib/moip2/resource/order.rb', line 6

def external_id
  @external_id
end

#payment_apiObject (readonly)

Returns the value of attribute payment_api.



6
7
8
# File 'lib/moip2/resource/order.rb', line 6

def payment_api
  @payment_api
end

Instance Method Details

#create_payment(payment) ⇒ Object



18
19
20
# File 'lib/moip2/resource/order.rb', line 18

def create_payment(payment)
  payment_api.create(external_id, payment)
end