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
-
#default_per_page ⇒ Object
Returns the value of attribute default_per_page.
-
#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.
55 56 57 |
# File 'lib/pina.rb', line 55 def initialize set_defaults end |
Instance Attribute Details
#api_host ⇒ Object
Returns the value of attribute api_host.
51 52 53 |
# File 'lib/pina.rb', line 51 def api_host @api_host end |
#api_token ⇒ Object
Returns the value of attribute api_token.
51 52 53 |
# File 'lib/pina.rb', line 51 def api_token @api_token end |
#api_version ⇒ Object (readonly)
Returns the value of attribute api_version.
52 53 54 |
# File 'lib/pina.rb', line 52 def api_version @api_version end |
#base_url ⇒ Object
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_page ⇒ Object
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 |
#email ⇒ Object
Returns the value of attribute email.
51 52 53 |
# File 'lib/pina.rb', line 51 def email @email end |
#tenant ⇒ Object
Returns the value of attribute tenant.
51 52 53 |
# File 'lib/pina.rb', line 51 def tenant @tenant end |
#use_ssl ⇒ Object
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
#schema ⇒ Object
69 70 71 |
# File 'lib/pina.rb', line 69 def schema use_ssl ? 'https://' : 'http://' end |
#set_defaults ⇒ Object
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_formatted ⇒ Object
73 74 75 |
# File 'lib/pina.rb', line 73 def tenant_formatted @tenant.blank? ? '' : @tenant + '.' end |