Sha256: 36b9e25677d86dee514162bfbe6630adbdd9b437a6e399ead31d900a6f12eac4

Contents?: true

Size: 1006 Bytes

Versions: 1

Compression:

Stored size: 1006 Bytes

Contents

require 'active_support'
require 'base64'
require 'json'
require 'typhoeus'
require 'virtus'

require 'pina/contact'
require 'pina/version'
require 'pina/rest_adapter'

require 'pina/models/address'
require 'pina/models/contact'
require 'pina/models/contact_list'

module Pina
  class ConfigurationNotSet < StandardError; end

  DEFAULT_API_VERSION = :v1
  DEFAULT_EMAIL       = 'dummy@email.com'
  DEFAULT_TENANT      = 'imaginary'

  SCHEME              = 'https://'
  API_PATH            = '.ucetnictvi.bonobo.cz/api/'

  class << self
    attr_accessor :configuration

    def configure
      self.configuration ||= Configuration.new
      yield(configuration)
    end
  end

  class Configuration
    attr_accessor :api_token, :email, :tenant
    attr_reader :api_version

    def initialize
      @api_version = DEFAULT_API_VERSION
      @email       = DEFAULT_EMAIL
      @tenant      = DEFAULT_TENANT
    end

    def base_url
      SCHEME + tenant + API_PATH + "#{api_version}/"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pina-0.1.0 lib/pina.rb