Class: Pina::Configuration
- Inherits:
-
Object
- Object
- Pina::Configuration
- Defined in:
- lib/pina.rb
Instance Attribute Summary collapse
-
#api_host ⇒ Object
Returns the value of attribute api_host.
-
#api_token ⇒ Object
Returns the value of attribute api_token.
-
#api_version ⇒ Object
readonly
Returns the value of attribute api_version.
- #base_url ⇒ Object
-
#email ⇒ Object
Returns the value of attribute email.
-
#tenant ⇒ Object
Returns the value of attribute tenant.
-
#use_ssl ⇒ Object
Returns the value of attribute use_ssl.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #schema ⇒ Object
- #set_defaults ⇒ Object
- #tenant_formatted ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
53 54 55 |
# File 'lib/pina.rb', line 53 def initialize set_defaults end |
Instance Attribute Details
#api_host ⇒ Object
Returns the value of attribute api_host.
49 50 51 |
# File 'lib/pina.rb', line 49 def api_host @api_host end |
#api_token ⇒ Object
Returns the value of attribute api_token.
49 50 51 |
# File 'lib/pina.rb', line 49 def api_token @api_token end |
#api_version ⇒ Object (readonly)
Returns the value of attribute api_version.
50 51 52 |
# File 'lib/pina.rb', line 50 def api_version @api_version end |
#base_url ⇒ Object
74 75 76 |
# File 'lib/pina.rb', line 74 def base_url @base_url = schema + tenant_formatted + api_host + '/api/' + "#{api_version}/" end |
#email ⇒ Object
Returns the value of attribute email.
49 50 51 |
# File 'lib/pina.rb', line 49 def email @email end |
#tenant ⇒ Object
Returns the value of attribute tenant.
49 50 51 |
# File 'lib/pina.rb', line 49 def tenant @tenant end |
#use_ssl ⇒ Object
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
#schema ⇒ Object
66 67 68 |
# File 'lib/pina.rb', line 66 def schema use_ssl ? 'https://' : 'http://' end |
#set_defaults ⇒ Object
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_formatted ⇒ Object
70 71 72 |
# File 'lib/pina.rb', line 70 def tenant_formatted @tenant.blank? ? '' : @tenant + '.' end |