Class: PriorityPayoutGateway::Api
- Inherits:
-
Object
- Object
- PriorityPayoutGateway::Api
- Includes:
- HTTParty
- Defined in:
- lib/priority_payout_gateway/api.rb
Direct Known Subclasses
Constant Summary collapse
- TRANSACTION_URL =
ENV.fetch("TRANSACTION_URL", "https://secure.prioritypayoutgateway.com/api/transact.php")
- QUERY_URL =
ENV.fetch( "QUERY_URL", "https://secure.prioritypayoutgateway.com/api/query.php")
Instance Attribute Summary collapse
-
#password ⇒ Object
Returns the value of attribute password.
-
#query ⇒ Object
Returns the value of attribute query.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #get(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Api
constructor
A new instance of Api.
- #post(options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Api
Returns a new instance of Api.
9 10 11 12 |
# File 'lib/priority_payout_gateway/api.rb', line 9 def initialize( = {}) @username = [:username] || ENV["PPG_USERNAME"] @password = [:password] || ENV["PPG_PASSWORD"] end |
Instance Attribute Details
#password ⇒ Object
Returns the value of attribute password.
7 8 9 |
# File 'lib/priority_payout_gateway/api.rb', line 7 def password @password end |
#query ⇒ Object
Returns the value of attribute query.
7 8 9 |
# File 'lib/priority_payout_gateway/api.rb', line 7 def query @query end |
#username ⇒ Object
Returns the value of attribute username.
7 8 9 |
# File 'lib/priority_payout_gateway/api.rb', line 7 def username @username end |
Instance Method Details
#get(options = {}) ⇒ Object
14 15 16 17 18 |
# File 'lib/priority_payout_gateway/api.rb', line 14 def get(={}) response = self.class.get(QUERY_URL, query: .merge(credentials), timeout: 30, headers: headers) api_type = [:type] || [:report_type] handle_response(response, api_type) end |
#post(options = {}) ⇒ Object
20 21 22 23 24 |
# File 'lib/priority_payout_gateway/api.rb', line 20 def post(={}) response = self.class.get(TRANSACTION_URL, query: .merge(credentials), timeout: 30, headers: headers) api_type = [:type] || [:customer_vault] handle_response(response, api_type) end |