Updated API types and base URL changes.
Signed-off-by: imi415 <imi415@imi.moe>
This commit is contained in:
parent
5a08ea60b4
commit
4a56f6ccda
|
@ -1,16 +1,22 @@
|
||||||
module MojiWeather
|
module MojiWeather
|
||||||
module Api
|
module Api
|
||||||
module ApiType
|
module ApiType
|
||||||
|
ALERT = 'alert'
|
||||||
|
AQI = 'aqi'
|
||||||
CONDITION = 'condition'
|
CONDITION = 'condition'
|
||||||
FORECAST_24HRS = 'forecast24hours'
|
FORECAST_24HRS = 'forecast24hours'
|
||||||
|
FORECAST_6DAYS = 'briefforecast6days'
|
||||||
FORECAST_15DAYS = 'forecast15days'
|
FORECAST_15DAYS = 'forecast15days'
|
||||||
AQI = 'aqi'
|
|
||||||
LIMIT = 'limit'
|
|
||||||
LIFE_INDEX = 'index'
|
LIFE_INDEX = 'index'
|
||||||
|
LIMIT = 'limit'
|
||||||
end
|
end
|
||||||
|
|
||||||
module Constants
|
module Constants
|
||||||
API_TOKENS = {
|
API_TOKENS = {
|
||||||
|
MojiWeather::Api::ApiType::ALERT => {
|
||||||
|
city_id: '7ebe966ee2e04bbd8cdbc0b84f7f3bc7',
|
||||||
|
location: 'd01246ac6284b5a591f875173e9e2a18'
|
||||||
|
},
|
||||||
MojiWeather::Api::ApiType::CONDITION => {
|
MojiWeather::Api::ApiType::CONDITION => {
|
||||||
city_id: '50b53ff8dd7d9fa320d3d3ca32cf8ed1',
|
city_id: '50b53ff8dd7d9fa320d3d3ca32cf8ed1',
|
||||||
location: 'ff826c205f8f4a59701e64e9e64e01c4'
|
location: 'ff826c205f8f4a59701e64e9e64e01c4'
|
||||||
|
@ -31,6 +37,10 @@ module MojiWeather
|
||||||
city_id: '5944a84ec4a071359cc4f6928b797f91',
|
city_id: '5944a84ec4a071359cc4f6928b797f91',
|
||||||
location: '42b0c7e2e8d00d6e80d92797fe5360fd'
|
location: '42b0c7e2e8d00d6e80d92797fe5360fd'
|
||||||
},
|
},
|
||||||
|
MojiWeather::Api::ApiType::FORECAST_6DAYS => {
|
||||||
|
city_id: '073854b56a84f8a4956ba3e273f6c9d7',
|
||||||
|
location: '0f9d7e535dfbfad15b8fd2a84fee3e36',
|
||||||
|
},
|
||||||
MojiWeather::Api::ApiType::FORECAST_15DAYS => {
|
MojiWeather::Api::ApiType::FORECAST_15DAYS => {
|
||||||
city_id: 'f9f212e1996e79e0e602b08ea297ffb0',
|
city_id: 'f9f212e1996e79e0e602b08ea297ffb0',
|
||||||
location: '7538f7246218bdbf795b329ab09cc524'
|
location: '7538f7246218bdbf795b329ab09cc524'
|
||||||
|
@ -38,4 +48,4 @@ module MojiWeather
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,8 +9,17 @@ module MojiWeather
|
||||||
end
|
end
|
||||||
@app_code = options[:app_code]
|
@app_code = options[:app_code]
|
||||||
|
|
||||||
@cityid_base = "http://aliv18.data.moji.com/whapi/json/alicityweather"
|
if options[:cityid_base].nil?
|
||||||
@location_base = "http://aliv8.data.moji.com/whapi/json/aliweather"
|
@cityid_base = "http://aliv18.data.moji.com/whapi/json/alicityweather"
|
||||||
|
else
|
||||||
|
@cityid_base = options[:cityid_base]
|
||||||
|
end
|
||||||
|
|
||||||
|
if options[:location_base].nil?
|
||||||
|
@location_base = "http://aliv8.data.moji.com/whapi/json/aliweather"
|
||||||
|
else
|
||||||
|
@location_base = options[:location_base]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def query(api_type, options = {})
|
def query(api_type, options = {})
|
||||||
|
@ -69,4 +78,5 @@ module MojiWeather
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue