Skip to content

Instantly share code, notes, and snippets.

@code-later
Created February 26, 2013 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save code-later/5037473 to your computer and use it in GitHub Desktop.
Save code-later/5037473 to your computer and use it in GitHub Desktop.
class Gateway
attr_reader :connection
def initialize(connection = Application.config.default_connection)
@connection = connection
end
def get(params)
request(:get, params)
end
# ...
private
def request(method, params)
begin
return @connection.send(method, params)
rescue Faraday::Error::ResourceNotFound => e
raise GatewayException.new(e)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment