Class: AstroInsight::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/astroinsight/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client_id: nil, client_secret: nil, base_url: nil, language: "en", ayanamsha: "lahiri", timeout: 30) ⇒ Client

Returns a new instance of Client.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/astroinsight/client.rb', line 16

def initialize(client_id: nil, client_secret: nil, base_url: nil, language: "en", ayanamsha: "lahiri", timeout: 30)
  @config = Configuration.new(
    client_id: client_id,
    client_secret: client_secret,
    base_url: base_url,
    language: language,
    ayanamsha: ayanamsha,
    timeout: timeout
  )

  @http_client = HttpClient.new(@config)

  @vedic = Services::VedicContainer.new(@http_client)
  @western = Services::WesternContainer.new(@http_client)
  @horoscope = Services::HoroscopeService.new(@http_client)
  @tarot = Services::TarotService.new(@http_client)
  @chinese = Services::ChineseAstrologyService.new(@http_client)
  @geo = Services::GeoService.new(@http_client)
end

Instance Attribute Details

#chineseObject (readonly)

Returns the value of attribute chinese.



14
15
16
# File 'lib/astroinsight/client.rb', line 14

def chinese
  @chinese
end

#configObject (readonly)

Returns the value of attribute config.



14
15
16
# File 'lib/astroinsight/client.rb', line 14

def config
  @config
end

#geoObject (readonly)

Returns the value of attribute geo.



14
15
16
# File 'lib/astroinsight/client.rb', line 14

def geo
  @geo
end

#horoscopeObject (readonly)

Returns the value of attribute horoscope.



14
15
16
# File 'lib/astroinsight/client.rb', line 14

def horoscope
  @horoscope
end

#http_clientObject (readonly)

Returns the value of attribute http_client.



14
15
16
# File 'lib/astroinsight/client.rb', line 14

def http_client
  @http_client
end

#tarotObject (readonly)

Returns the value of attribute tarot.



14
15
16
# File 'lib/astroinsight/client.rb', line 14

def tarot
  @tarot
end

#vedicObject (readonly)

Returns the value of attribute vedic.



14
15
16
# File 'lib/astroinsight/client.rb', line 14

def vedic
  @vedic
end

#westernObject (readonly)

Returns the value of attribute western.



14
15
16
# File 'lib/astroinsight/client.rb', line 14

def western
  @western
end

Instance Method Details

#set_ayanamsha(ayanamsha) ⇒ Object



41
42
43
44
# File 'lib/astroinsight/client.rb', line 41

def set_ayanamsha(ayanamsha)
  @config.ayanamsha = ayanamsha
  self
end

#set_language(language) ⇒ Object



36
37
38
39
# File 'lib/astroinsight/client.rb', line 36

def set_language(language)
  @config.language = language
  self
end