Module: Unleashed::Configurable
Overview
Instance Attribute Summary collapse
-
#api_domain ⇒ Object
Returns the value of attribute api_domain.
-
#api_id ⇒ Object
Returns the value of attribute api_id.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#client_type_header ⇒ Object
Returns the value of attribute client_type_header.
-
#errors_format ⇒ Object
Returns the value of attribute errors_format.
Class Method Summary collapse
-
.keys ⇒ Array
List of configurable keys for Client.
Instance Method Summary collapse
-
#api_endpoint ⇒ String
API endpoint to be used by Client.
-
#reset! ⇒ Object
(also: #setup)
Reset configuration options to default values.
Instance Attribute Details
#api_domain ⇒ Object
Returns the value of attribute api_domain.
4 5 6 |
# File 'lib/unleashed/configurable.rb', line 4 def api_domain @api_domain end |
#api_id ⇒ Object
Returns the value of attribute api_id.
4 5 6 |
# File 'lib/unleashed/configurable.rb', line 4 def api_id @api_id end |
#api_key ⇒ Object
Returns the value of attribute api_key.
4 5 6 |
# File 'lib/unleashed/configurable.rb', line 4 def api_key @api_key end |
#client_type_header ⇒ Object
Returns the value of attribute client_type_header.
4 5 6 |
# File 'lib/unleashed/configurable.rb', line 4 def client_type_header @client_type_header end |
#errors_format ⇒ Object
Returns the value of attribute errors_format.
4 5 6 |
# File 'lib/unleashed/configurable.rb', line 4 def errors_format @errors_format end |
Class Method Details
.keys ⇒ Array
List of configurable keys for Unleashed::Client.
11 12 13 14 15 16 17 18 19 |
# File 'lib/unleashed/configurable.rb', line 11 def keys @keys ||= [ :api_domain, :api_id, :api_key, :client_type_header, :errors_format ] end |
Instance Method Details
#api_endpoint ⇒ String
API endpoint to be used by Unleashed::Client. Built from #api_domain
37 38 39 |
# File 'lib/unleashed/configurable.rb', line 37 def api_endpoint "https://#{@api_domain}/" end |
#reset! ⇒ Object Also known as: setup
Reset configuration options to default values.
23 24 25 26 27 28 29 |
# File 'lib/unleashed/configurable.rb', line 23 def reset! Unleashed::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", Unleashed::Default.[key]) end self end |