lib/voucherify/client.rb in voucherify-1.6.1 vs lib/voucherify/client.rb in voucherify-2.0.0
- old
+ new
@@ -12,11 +12,11 @@
@backend_url = 'https://api.voucherify.io/v1'
@headers = {
'X-App-Id' => @options[:applicationId] || @options['applicationId'],
'X-App-Token' => @options[:clientSecretKey] || @options['clientSecretKey'],
'X-Voucherify-Channel' => 'Ruby-SDK',
- 'X-Voucherify-API-Version' => @options[:apiVersion] || @options['apiVersion'],
+ 'X-Voucherify-API-Version' => @options[:apiVersion] || @options['apiVersion'] || 'v2018-08-01',
:accept => :json,
}.reject{ |k,v| v.nil? }
@timeout = @options[:timeout] || @options['timeout']
end
@@ -106,17 +106,17 @@
rescue RestClient::Exception => e
raise VoucherifyError.new(e)
end
end
end
-
+
class VoucherifyError < RuntimeError
attr_reader :response
attr_reader :code
attr_reader :details
attr_reader :key
-
+
def initialize (restClientError)
if restClientError.is_a? RestClient::Exceptions::Timeout
@response = restClientError
@details = restClientError
super(restClientError)
@@ -129,6 +129,6 @@
super(parsedResponse['message'])
end
end
end
-end
\ No newline at end of file
+end