class Bambora::Builders::Headers
Builds Headers
for HTTP requests.
Attributes
api_key[R]
content_type[R]
merchant_id[R]
sub_merchant_id[R]
Public Class Methods
new(options = {})
click to toggle source
Initialize a new Headers
object.
@param options [String] @param options [String] @param options [String] optional. @param options [String] optional.
# File lib/bambora/builders/headers.rb, line 17 def initialize(options = {}) options.each do |key, value| instance_variable_set("@#{key}", value) end end
Public Instance Methods
build()
click to toggle source
Builds a header object.
@return [Hash]
# File lib/bambora/builders/headers.rb, line 27 def build headers = { 'Authorization' => "Passcode #{passcode}", } headers['Content-Type'] = content_type if content_type headers['Sub-Merchant-Id'] = sub_merchant_id if sub_merchant_id headers end
Private Instance Methods
passcode()
click to toggle source
# File lib/bambora/builders/headers.rb, line 38 def passcode Base64.encode64("#{merchant_id}:#{api_key}").delete("\n") end