lib/shipcloud.rb in shipcloud-0.7.0 vs lib/shipcloud.rb in shipcloud-0.8.0

- old
+ new

@@ -11,15 +11,19 @@ API_HEADERS = { "Content-Type" => "application/json", "User-Agent" => "shipcloud-ruby v#{Shipcloud::VERSION}, API #{Shipcloud::API_VERSION}, #{RUBY_VERSION}, #{RUBY_PLATFORM}, #{RUBY_PATCHLEVEL}" } + DEFAULT_AFFILIATE_ID = "integration.shipcloud-ruby-gem.v#{Shipcloud::VERSION}".freeze + autoload :Base, "shipcloud/base" autoload :Shipment, "shipcloud/shipment" autoload :Carrier, "shipcloud/carrier" autoload :Address, "shipcloud/address" + autoload :PickupRequest, "shipcloud/pickup_request" autoload :ShipmentQuote, "shipcloud/shipment_quote" + autoload :Tracker, "shipcloud/tracker" autoload :Webhook, "shipcloud/webhook" module Operations autoload :Create, "shipcloud/operations/create" autoload :Find, "shipcloud/operations/find" @@ -44,12 +48,17 @@ def self.configure yield(configuration) end + def self.api_headers + API_HEADERS.merge( + "Affiliate-ID" => configuration.affiliate_id || DEFAULT_AFFILIATE_ID + ) + end class Configuration - attr_accessor :api_key, :api_base, :use_ssl, :debug + attr_accessor :affiliate_id, :api_key, :api_base, :use_ssl, :debug def initialize @api_key = nil @api_base = 'api.shipcloud.io' @use_ssl = true