lib/createsend.rb in createsend-0.0.2 vs lib/createsend.rb in createsend-0.1.0
- old
+ new
@@ -33,19 +33,19 @@
end
class ClientError < StandardError; end
class ServerError < StandardError; end
class BadRequest < CreateSendError; end
-class Unauthorized < ClientError; end
+class Unauthorized < CreateSendError; end
class NotFound < ClientError; end
class Unavailable < StandardError; end
# Provides high level CreateSend functionality/data you'll probably need.
class CreateSend
include HTTParty
- VER = "0.0.2" unless defined?(CreateSend::VER)
+ VER = "0.1.0" unless defined?(CreateSend::VER)
headers({ 'User-Agent' => "createsend-ruby-#{CreateSend::VER}", 'Content-Type' => 'application/json' })
base_uri CreateSendOptions['base_uri']
basic_auth CreateSendOptions['api_key'], 'x'
# Sets the API key which will be used to make calls to the CreateSend API.
@@ -98,10 +98,10 @@
def self.handle_response(response) # :nodoc:
case response.code
when 400
raise BadRequest.new(Hashie::Mash.new response)
when 401
- raise Unauthorized.new
+ raise Unauthorized.new(Hashie::Mash.new response)
when 404
raise NotFound.new
when 400...500
raise ClientError.new
when 500...600