Sha256: 6771404bbd4b3f47b0748506032c4a83f607c137456557cd1ca377dad410b259

Contents?: true

Size: 687 Bytes

Versions: 2

Compression:

Stored size: 687 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

2 entries across 2 versions & 1 rubygems

Version Path
trustvox-0.3.0 lib/trustvox/base.rb
trustvox-0.2.0 lib/trustvox/base.rb