lib/esendex/api_connection.rb in esendex-0.3.2 vs lib/esendex/api_connection.rb in esendex-0.4.0

- old
+ new

@@ -1,28 +1,29 @@ require 'nestful' -class ApiConnection +module Esendex + class ApiConnection - def initialize - @connection = Nestful::Connection.new(Esendex::API_HOST) - @connection.user = Esendex.username - @connection.password = Esendex.password - @connection.auth_type = :basic - end + def initialize + @connection = Nestful::Connection.new(Esendex::API_HOST) + @connection.user = Esendex.username + @connection.password = Esendex.password + @connection.auth_type = :basic + end - def default_headers - { 'User-Agent' => Esendex.user_agent } - end + def default_headers + { 'User-Agent' => Esendex.user_agent } + end - def get(url) - @connection.get url, default_headers - rescue => e - raise Esendex::ApiErrorFactory.new.get_api_error(e) - end + def get(url) + @connection.get url, default_headers + rescue => e + raise Esendex::ApiErrorFactory.new.get_api_error(e) + end - def post(url, body) - @connection.post url, body, default_headers - rescue => e - raise Esendex::ApiErrorFactory.new.get_api_error(e) + def post(url, body) + @connection.post url, body, default_headers + rescue => e + raise Esendex::ApiErrorFactory.new.get_api_error(e) + end end - -end \ No newline at end of file +end