Sha256: 6aaf3683b17752a7d9411be546a89037c46337f0938e5cebbfba2e751165d910

Contents?: true

Size: 695 Bytes

Versions: 1

Compression:

Stored size: 695 Bytes

Contents

require 'httparty'

module Trustvox
  # Base class for all api request
  class Base
    include HTTParty

    headers 'Accept' => 'application/vnd.trustvox.com; version=1',
            'Content-Type' => 'application/json'

    def initialize
      if Config.is_on_staging?
        self.class.base_uri 'http://staging.trustvox.com.br/api'
        seld.class.debug_output $stdout
      else
        self.class.base_uri 'http://trustvox.com.br/api'
      end
    end

    def auth_by_platform_token!
      self.class.headers 'Authorization' => "token #{Config.token}"
    end

    def auth_by_store_token!
      self.class.headers 'Authorization' => "token #{Config.store_token}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trustvox-0.4.0 lib/trustvox/base.rb