Class: AstroInsight::Configuration
- Inherits:
-
Object
- Object
- AstroInsight::Configuration
- Defined in:
- lib/astroinsight/configuration.rb
Constant Summary collapse
- DEFAULT_BASE_URL =
"https://json.astroinsightapi.com/api/v1/"
Instance Attribute Summary collapse
-
#ayanamsha ⇒ Object
Returns the value of attribute ayanamsha.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#language ⇒ Object
Returns the value of attribute language.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
- #headers ⇒ Object
-
#initialize(client_id: nil, client_secret: nil, base_url: nil, language: "en", ayanamsha: "lahiri", timeout: 30) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(client_id: nil, client_secret: nil, base_url: nil, language: "en", ayanamsha: "lahiri", timeout: 30) ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 14 15 16 17 |
# File 'lib/astroinsight/configuration.rb', line 9 def initialize(client_id: nil, client_secret: nil, base_url: nil, language: "en", ayanamsha: "lahiri", timeout: 30) @client_id = client_id @client_secret = client_secret url = base_url || DEFAULT_BASE_URL @base_url = url.end_with?("/") ? url : "#{url}/" @language = language @ayanamsha = ayanamsha @timeout = timeout end |
Instance Attribute Details
#ayanamsha ⇒ Object
Returns the value of attribute ayanamsha.
5 6 7 |
# File 'lib/astroinsight/configuration.rb', line 5 def ayanamsha @ayanamsha end |
#base_url ⇒ Object
Returns the value of attribute base_url.
5 6 7 |
# File 'lib/astroinsight/configuration.rb', line 5 def base_url @base_url end |
#client_id ⇒ Object
Returns the value of attribute client_id.
5 6 7 |
# File 'lib/astroinsight/configuration.rb', line 5 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
5 6 7 |
# File 'lib/astroinsight/configuration.rb', line 5 def client_secret @client_secret end |
#language ⇒ Object
Returns the value of attribute language.
5 6 7 |
# File 'lib/astroinsight/configuration.rb', line 5 def language @language end |
#timeout ⇒ Object
Returns the value of attribute timeout.
5 6 7 |
# File 'lib/astroinsight/configuration.rb', line 5 def timeout @timeout end |
Instance Method Details
#headers ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/astroinsight/configuration.rb', line 19 def headers { "Accept" => "application/json", "Content-Type" => "application/json", "Accept-Language" => @language, "X-Ayanamsha" => @ayanamsha } end |