lib/voucherify/client.rb in voucherify-1.0.0 vs lib/voucherify/client.rb in voucherify-1.1.0

- old
+ new

@@ -3,16 +3,18 @@ require 'json' module Voucherify class Client + attr_reader :backend_url + def initialize (options) @options = options @backend_url = 'https://api.voucherify.io/v1' @headers = { - 'X-App-Id' => @options[:applicationId], - 'X-App-Token' => @options[:clientSecretKey], + 'X-App-Id' => @options[:applicationId] || @options['applicationId'], + 'X-App-Token' => @options[:clientSecretKey] || @options['clientSecretKey'], 'X-Voucherify-Channel' => 'Ruby-SDK', :accept => :json } end @@ -32,9 +34,17 @@ Voucherify::Service::Redemptions.new(self) end def customers Voucherify::Service::Customers.new(self) + end + + def products + Voucherify::Service::Products.new(self) + end + + def campaigns + Voucherify::Service::Campaigns.new(self) end def get(path, params = {}) url = @backend_url + path response = RestClient.get(url, @headers.merge({:params => params})) \ No newline at end of file