Module: GoPay
- Defined in:
- lib/gopay.rb,
lib/gopay/error.rb,
lib/gopay/payment.rb,
lib/gopay/version.rb
Defined Under Namespace
Classes: Error, Payment, Version
Class Attribute Summary collapse
-
.client_id ⇒ Object
Returns the value of attribute client_id.
-
.client_secret ⇒ Object
Returns the value of attribute client_secret.
-
.gate ⇒ Object
Returns the value of attribute gate.
-
.goid ⇒ Object
Returns the value of attribute goid.
-
.notification_host ⇒ Object
Returns the value of attribute notification_host.
-
.return_host ⇒ Object
Returns the value of attribute return_host.
Class Method Summary collapse
Class Attribute Details
.client_id ⇒ Object
Returns the value of attribute client_id.
5 6 7 |
# File 'lib/gopay.rb', line 5 def client_id @client_id end |
.client_secret ⇒ Object
Returns the value of attribute client_secret.
5 6 7 |
# File 'lib/gopay.rb', line 5 def client_secret @client_secret end |
.gate ⇒ Object
Returns the value of attribute gate.
5 6 7 |
# File 'lib/gopay.rb', line 5 def gate @gate end |
.goid ⇒ Object
Returns the value of attribute goid.
5 6 7 |
# File 'lib/gopay.rb', line 5 def goid @goid end |
.notification_host ⇒ Object
Returns the value of attribute notification_host.
5 6 7 |
# File 'lib/gopay.rb', line 5 def notification_host @notification_host end |
.return_host ⇒ Object
Returns the value of attribute return_host.
5 6 7 |
# File 'lib/gopay.rb', line 5 def return_host @return_host end |
Class Method Details
.configure {|_self| ... } ⇒ Object
8 9 10 |
# File 'lib/gopay.rb', line 8 def self.configure yield self end |
.request(method, path, body_parameters: {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/gopay.rb', line 12 def self.request(method, path, body_parameters: {}) token = token get_token_scope(method, path) content_type = get_content_type(path) body_parameters = content_type == 'application/json' ? body_parameters.to_json : from_hash_to_query(body_parameters) response = Unirest.send(method, GoPay.gate+path, headers: { "Accept" => "application/json", "Content-Type" => content_type, "Authorization" => "Bearer #{token}" }, parameters: body_parameters) unless response.code == 200 raise GoPay::Error.handle_gopay_error(response) end response.body end |