Class: Pina::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/pina.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



53
54
55
# File 'lib/pina.rb', line 53

def initialize
  set_defaults
end

Instance Attribute Details

#api_hostObject

Returns the value of attribute api_host.



49
50
51
# File 'lib/pina.rb', line 49

def api_host
  @api_host
end

#api_tokenObject

Returns the value of attribute api_token.



49
50
51
# File 'lib/pina.rb', line 49

def api_token
  @api_token
end

#api_versionObject (readonly)

Returns the value of attribute api_version.



50
51
52
# File 'lib/pina.rb', line 50

def api_version
  @api_version
end

#base_urlObject



74
75
76
# File 'lib/pina.rb', line 74

def base_url
  @base_url = schema + tenant_formatted + api_host + '/api/' + "#{api_version}/"
end

#emailObject

Returns the value of attribute email.



49
50
51
# File 'lib/pina.rb', line 49

def email
  @email
end

#tenantObject

Returns the value of attribute tenant.



49
50
51
# File 'lib/pina.rb', line 49

def tenant
  @tenant
end

#use_sslObject

Returns the value of attribute use_ssl.



49
50
51
# File 'lib/pina.rb', line 49

def use_ssl
  @use_ssl
end

Instance Method Details

#schemaObject



66
67
68
# File 'lib/pina.rb', line 66

def schema
  use_ssl ? 'https://' : 'http://'
end

#set_defaultsObject



57
58
59
60
61
62
63
64
# File 'lib/pina.rb', line 57

def set_defaults
  @api_version = DEFAULT_API_VERSION
  @email       = DEFAULT_EMAIL
  @tenant      = DEFAULT_TENANT
  @api_host    = API_HOST
  @use_ssl     = true
  @base_url    = nil
end

#tenant_formattedObject



70
71
72
# File 'lib/pina.rb', line 70

def tenant_formatted
  @tenant.blank? ? '' : @tenant + '.'
end