Class: Zooz::Request::Open
- Inherits:
-
Object
- Object
- Zooz::Request::Open
- Defined in:
- lib/zooz/request/open.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#currency_code ⇒ Object
Returns the value of attribute currency_code.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#requestor ⇒ Object
Returns the value of attribute requestor.
Instance Method Summary collapse
-
#initialize ⇒ Open
constructor
A new instance of Open.
- #request ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
8 9 10 |
# File 'lib/zooz/request/open.rb', line 8 def amount @amount end |
#currency_code ⇒ Object
Returns the value of attribute currency_code.
8 9 10 |
# File 'lib/zooz/request/open.rb', line 8 def currency_code @currency_code end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
9 10 11 |
# File 'lib/zooz/request/open.rb', line 9 def errors @errors end |
#requestor ⇒ Object
Returns the value of attribute requestor.
8 9 10 |
# File 'lib/zooz/request/open.rb', line 8 def requestor @requestor end |
Instance Method Details
#request ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/zooz/request/open.rb', line 20 def request return false unless valid? @requestor.set_param('amount', @amount) @requestor.set_param('currencyCode', @currency_code) open_response = Response::Open.new open_response.request = self open_response.response = @requestor.request unless open_response.response @errors += @requestor.errors return false end open_response end |
#valid? ⇒ Boolean
34 35 36 37 38 39 40 |
# File 'lib/zooz/request/open.rb', line 34 def valid? @errors = [] @errors << 'amount is required' if @amount.nil? @errors << 'currency_code is required' if @currency_code.nil? @errors += @requestor.errors unless @requestor.valid? @errors.empty? end |