Class: IqairAirvisual::Client

Inherits:
Object
  • Object
show all
Includes:
Community, Constants
Defined in:
lib/iqair_airvisual/client.rb

Constant Summary

Constants included from Constants

IqairAirvisual::Constants::AQI_INDEX, IqairAirvisual::Constants::BASE_PATH, IqairAirvisual::Constants::IMAGES_PATH, IqairAirvisual::Constants::UNITS, IqairAirvisual::Constants::WEATHER_CODES, IqairAirvisual::Constants::WEATHER_ICON_INDEX

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Community

#cities, #city, #countries, #nearest_city, #states

Methods included from Constants

#calculate_aqi_range

Constructor Details

#initialize(api_key:, base_path: BASE_PATH, port: 80) ⇒ Client

Returns a new instance of Client.



27
28
29
30
31
# File 'lib/iqair_airvisual/client.rb', line 27

def initialize(api_key:, base_path: BASE_PATH, port: 80)
  @api_key = api_key
  @base_path = base_path
  @port = port
end

Instance Attribute Details

#api_keyObject (readonly)

TODO: Air quality guidelines TODO: Units breakdown TODO: Return codes api-docs.iqair.com/?version=latest Below are a few example of return codes you may get. This list is not exhaustive. success: returned when JSON file was generated successfully. call_limit_reached: returned when minute/monthly limit is reached. api_key_expired: returned when API key is expired. incorrect_api_key: returned when using wrong API key. ip_location_failed: returned when service is unable to locate IP address of request. no_nearest_station: returned when there is no nearest station within specified radius. feature_not_available: returned when call requests a feature that is not available in chosen subscription plan. too_many_requests: returned when more than 10 calls per second are made.



20
21
22
# File 'lib/iqair_airvisual/client.rb', line 20

def api_key
  @api_key
end

#base_pathObject (readonly)

TODO: Air quality guidelines TODO: Units breakdown TODO: Return codes api-docs.iqair.com/?version=latest Below are a few example of return codes you may get. This list is not exhaustive. success: returned when JSON file was generated successfully. call_limit_reached: returned when minute/monthly limit is reached. api_key_expired: returned when API key is expired. incorrect_api_key: returned when using wrong API key. ip_location_failed: returned when service is unable to locate IP address of request. no_nearest_station: returned when there is no nearest station within specified radius. feature_not_available: returned when call requests a feature that is not available in chosen subscription plan. too_many_requests: returned when more than 10 calls per second are made.



20
21
22
# File 'lib/iqair_airvisual/client.rb', line 20

def base_path
  @base_path
end

#expiryObject (readonly)

TODO: Air quality guidelines TODO: Units breakdown TODO: Return codes api-docs.iqair.com/?version=latest Below are a few example of return codes you may get. This list is not exhaustive. success: returned when JSON file was generated successfully. call_limit_reached: returned when minute/monthly limit is reached. api_key_expired: returned when API key is expired. incorrect_api_key: returned when using wrong API key. ip_location_failed: returned when service is unable to locate IP address of request. no_nearest_station: returned when there is no nearest station within specified radius. feature_not_available: returned when call requests a feature that is not available in chosen subscription plan. too_many_requests: returned when more than 10 calls per second are made.



20
21
22
# File 'lib/iqair_airvisual/client.rb', line 20

def expiry
  @expiry
end

#login_responseObject (readonly)

TODO: Air quality guidelines TODO: Units breakdown TODO: Return codes api-docs.iqair.com/?version=latest Below are a few example of return codes you may get. This list is not exhaustive. success: returned when JSON file was generated successfully. call_limit_reached: returned when minute/monthly limit is reached. api_key_expired: returned when API key is expired. incorrect_api_key: returned when using wrong API key. ip_location_failed: returned when service is unable to locate IP address of request. no_nearest_station: returned when there is no nearest station within specified radius. feature_not_available: returned when call requests a feature that is not available in chosen subscription plan. too_many_requests: returned when more than 10 calls per second are made.



20
21
22
# File 'lib/iqair_airvisual/client.rb', line 20

def 
  @login_response
end

#portObject (readonly)

TODO: Air quality guidelines TODO: Units breakdown TODO: Return codes api-docs.iqair.com/?version=latest Below are a few example of return codes you may get. This list is not exhaustive. success: returned when JSON file was generated successfully. call_limit_reached: returned when minute/monthly limit is reached. api_key_expired: returned when API key is expired. incorrect_api_key: returned when using wrong API key. ip_location_failed: returned when service is unable to locate IP address of request. no_nearest_station: returned when there is no nearest station within specified radius. feature_not_available: returned when call requests a feature that is not available in chosen subscription plan. too_many_requests: returned when more than 10 calls per second are made.



20
21
22
# File 'lib/iqair_airvisual/client.rb', line 20

def port
  @port
end

TODO: Air quality guidelines TODO: Units breakdown TODO: Return codes api-docs.iqair.com/?version=latest Below are a few example of return codes you may get. This list is not exhaustive. success: returned when JSON file was generated successfully. call_limit_reached: returned when minute/monthly limit is reached. api_key_expired: returned when API key is expired. incorrect_api_key: returned when using wrong API key. ip_location_failed: returned when service is unable to locate IP address of request. no_nearest_station: returned when there is no nearest station within specified radius. feature_not_available: returned when call requests a feature that is not available in chosen subscription plan. too_many_requests: returned when more than 10 calls per second are made.



20
21
22
# File 'lib/iqair_airvisual/client.rb', line 20

def raw_cookie
  @raw_cookie
end

Class Method Details

.api_versionObject

This is the version of the API docs this client was built off-of



38
39
40
# File 'lib/iqair_airvisual/client.rb', line 38

def self.api_version
  'v2 2021-04-18'
end

.compatible_api_versionObject



33
34
35
# File 'lib/iqair_airvisual/client.rb', line 33

def self.compatible_api_version
  'v2'
end