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.



55
56
57
# File 'lib/pina.rb', line 55

def initialize
  set_defaults
end

Instance Attribute Details

#api_hostObject

Returns the value of attribute api_host.



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

def api_host
  @api_host
end

#api_tokenObject

Returns the value of attribute api_token.



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

def api_token
  @api_token
end

#api_versionObject (readonly)

Returns the value of attribute api_version.



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

def api_version
  @api_version
end

#base_urlObject



77
78
79
# File 'lib/pina.rb', line 77

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

#default_per_pageObject

Returns the value of attribute default_per_page.



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

def default_per_page
  @default_per_page
end

#emailObject

Returns the value of attribute email.



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

def email
  @email
end

#tenantObject

Returns the value of attribute tenant.



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

def tenant
  @tenant
end

#use_sslObject

Returns the value of attribute use_ssl.



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

def use_ssl
  @use_ssl
end

Instance Method Details

#schemaObject



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

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

#set_defaultsObject



59
60
61
62
63
64
65
66
67
# File 'lib/pina.rb', line 59

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

#tenant_formattedObject



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

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