Class: Cielo::API30::Request::QuerySaleRequest

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(merchant, environment) ⇒ QuerySaleRequest

Returns a new instance of QuerySaleRequest.



10
11
12
13
# File 'lib/cielo/api30/request/query_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/query_sale_request.rb', line 7

def environment=(value)
  @environment = value
end

Instance Method Details

#execute(payment_id) ⇒ Object



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

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