Class: Espago::ApiConnection
- Inherits:
-
Object
- Object
- Espago::ApiConnection
- Extended by:
- Forwardable
- Defined in:
- lib/espago/api_connection.rb,
lib/espago/api_connection/get_tokens.rb,
lib/espago/api_connection/get_charges.rb,
lib/espago/api_connection/get_clients.rb,
lib/espago/api_connection/post_tokens.rb,
lib/espago/api_connection/put_clients.rb,
lib/espago/api_connection/post_charges.rb,
lib/espago/api_connection/post_clients.rb,
lib/espago/api_connection/post_complete.rb,
lib/espago/api_connection/delete_charges.rb,
lib/espago/api_connection/delete_clients.rb,
lib/espago/api_connection/post_charges_refund.rb,
lib/espago/api_connection/post_clients_authorize.rb
Defined Under Namespace
Classes: DeleteCharges, DeleteClients, GetCharges, GetClients, GetTokens, PostCharges, PostChargesRefund, PostClients, PostClientsAuthorize, PostComplete, PostTokens, PutClients
Constant Summary collapse
- Error =
Class.new(StandardError)
- AuthenticationError =
Class.new(StandardError)
Instance Method Summary collapse
- #create(path, method, params = {}) ⇒ Object
-
#initialize(enviroment) ⇒ ApiConnection
constructor
A new instance of ApiConnection.
Constructor Details
#initialize(enviroment) ⇒ ApiConnection
Returns a new instance of ApiConnection.
17 18 19 20 |
# File 'lib/espago/api_connection.rb', line 17 def initialize(enviroment) @connection = Faraday.new(enviroment) @router = Router end |
Instance Method Details
#create(path, method, params = {}) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/espago/api_connection.rb', line 22 def create(path, method, params = {} ) route = @router.new(path, method).route response = route.new(@connection).request(params) handle_response response end |