Class: Cielo::API30::Request::UpdateSaleRequest
- Inherits:
-
CieloRequest
- Object
- CieloRequest
- Cielo::API30::Request::UpdateSaleRequest
- Defined in:
- lib/cielo/api30/request/update_sale_request.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#environment ⇒ Object
writeonly
Sets the attribute environment.
-
#service_tax_amount ⇒ Object
Returns the value of attribute service_tax_amount.
-
#type ⇒ Object
writeonly
Sets the attribute type.
Instance Method Summary collapse
- #execute(payment_id) ⇒ Object
-
#initialize(type, merchant, environment) ⇒ UpdateSaleRequest
constructor
A new instance of UpdateSaleRequest.
Constructor Details
#initialize(type, merchant, environment) ⇒ UpdateSaleRequest
Returns a new instance of UpdateSaleRequest.
14 15 16 17 18 |
# File 'lib/cielo/api30/request/update_sale_request.rb', line 14 def initialize(type, merchant, environment) super(merchant) @environment = environment @type = type end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
7 8 9 |
# File 'lib/cielo/api30/request/update_sale_request.rb', line 7 def amount @amount end |
#environment=(value) ⇒ Object
Sets the attribute environment
7 8 9 |
# File 'lib/cielo/api30/request/update_sale_request.rb', line 7 def environment=(value) @environment = value end |
#service_tax_amount ⇒ Object
Returns the value of attribute service_tax_amount.
7 8 9 |
# File 'lib/cielo/api30/request/update_sale_request.rb', line 7 def service_tax_amount @service_tax_amount end |
#type=(value) ⇒ Object
Sets the attribute type
7 8 9 |
# File 'lib/cielo/api30/request/update_sale_request.rb', line 7 def type=(value) @type = value end |
Instance Method Details
#execute(payment_id) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/cielo/api30/request/update_sale_request.rb', line 20 def execute(payment_id) uri = URI.parse([@environment.api, "1", "sales", payment_id, type].join("/")) params = {} params["amount"] = amount if amount params["serviceTaxAmount"] = service_tax_amount if service_tax_amount uri.query = URI.encode_www_form(params) Cielo::API30::Payment.from_json(send_request("PUT", uri)) end |