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.



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

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.



4
5
6
# File 'lib/moip2/resource/order.rb', line 4

def client
  @client
end

#external_idObject (readonly)

Returns the value of attribute external_id.



4
5
6
# File 'lib/moip2/resource/order.rb', line 4

def external_id
  @external_id
end

#payment_apiObject (readonly)

Returns the value of attribute payment_api.



4
5
6
# File 'lib/moip2/resource/order.rb', line 4

def payment_api
  @payment_api
end

Instance Method Details

#create_payment(payment) ⇒ Object



16
17
18
# File 'lib/moip2/resource/order.rb', line 16

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