Class: Braspag::Request::UpdateSaleRequest
- Inherits:
-
BraspagRequest
- Object
- BraspagRequest
- Braspag::Request::UpdateSaleRequest
- Defined in:
- lib/braspag/api/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.
12 13 14 15 16 17 |
# File 'lib/braspag/api/request/update_sale_request.rb', line 12 def initialize(type, merchant, environment) super(merchant) @environment = environment @type = type end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
5 6 7 |
# File 'lib/braspag/api/request/update_sale_request.rb', line 5 def amount @amount end |
#environment=(value) ⇒ Object
Sets the attribute environment
5 6 7 |
# File 'lib/braspag/api/request/update_sale_request.rb', line 5 def environment=(value) @environment = value end |
#service_tax_amount ⇒ Object
Returns the value of attribute service_tax_amount.
5 6 7 |
# File 'lib/braspag/api/request/update_sale_request.rb', line 5 def service_tax_amount @service_tax_amount end |
#type=(value) ⇒ Object
Sets the attribute type
5 6 7 |
# File 'lib/braspag/api/request/update_sale_request.rb', line 5 def type=(value) @type = value end |
Instance Method Details
#execute(payment_id) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/braspag/api/request/update_sale_request.rb', line 19 def execute(payment_id) uri = URI.parse(@environment.api + "v2/sales/" + payment_id + "/" + type) params = {} if (amount != nil) params["amount"] = amount end if (service_tax_amount != nil) params["serviceTaxAmount"] = service_tax_amount end uri.query = URI.encode_www_form(params) Braspag::Payment.from_json(send_request("PUT", uri)) end |