Class: Cielo::API30::Request::CreateSaleRequest

Inherits:
CieloRequest
  • Object
show all
Defined in:
lib/cielo/api30/request/create_sale_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(merchant, environment) ⇒ CreateSaleRequest

Returns a new instance of CreateSaleRequest.



10
11
12
13
# File 'lib/cielo/api30/request/create_sale_request.rb', line 10

def initialize(merchant, environment)
  super(merchant)
  @environment = environment
end

Instance Attribute Details

#environment=(value) ⇒ Object

Sets the attribute environment

Parameters:

  • value

    the value to set the attribute environment to.



7
8
9
# File 'lib/cielo/api30/request/create_sale_request.rb', line 7

def environment=(value)
  @environment = value
end

Instance Method Details

#execute(sale) ⇒ Object



15
16
17
18
# File 'lib/cielo/api30/request/create_sale_request.rb', line 15

def execute(sale)
  uri = URI.parse([@environment.api, "1", "sales"].join("/"))
  Cielo::API30::Sale.from_json(send_request("POST", uri, sale))
end