Class: MonoMerchant::ApiRequest
- Inherits:
-
Object
- Object
- MonoMerchant::ApiRequest
- Defined in:
- lib/mono-merchant/api_request.rb
Direct Known Subclasses
Details, Invoice::Cancel, Invoice::Create, Invoice::Finalize, Invoice::PaymentInfo, Invoice::Remove, Pubkey, Qr::Details, Qr::List, Qr::ResetAmount, Statement, Submerchant::List, Wallet::Card, Wallet::List, Wallet::Payment
Constant Summary collapse
- API_URL =
"https://api.monobank.ua/api"
- DEFAULT_CURRENCY =
"UAH"
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type: :post) ⇒ ApiRequest
constructor
A new instance of ApiRequest.
- #url ⇒ Object
Constructor Details
#initialize(type: :post) ⇒ ApiRequest
Returns a new instance of ApiRequest.
11 12 13 14 15 |
# File 'lib/mono-merchant/api_request.rb', line 11 def initialize(type: :post) @type = type @errors = [] response end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object (private)
77 78 79 80 81 82 |
# File 'lib/mono-merchant/api_request.rb', line 77 def method_missing(name, *args) cam_name = name.to_s.camelize(:lower) return super unless data.include?(cam_name) response[cam_name] if response end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
9 10 11 |
# File 'lib/mono-merchant/api_request.rb', line 9 def errors @errors end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/mono-merchant/api_request.rb', line 9 def type @type end |
Instance Method Details
#url ⇒ Object
17 18 19 |
# File 'lib/mono-merchant/api_request.rb', line 17 def url "#{API_URL}/#{self.class.name.underscore.dasherize.sub('mono-', '')}#{url_query}" end |