zetabot 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/Gemfile.lock +1 -1
 - data/lib/Zeta/plugins/weather.rb +16 -15
 - data/lib/Zeta/version.rb +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 6e927c6006c02faf5117ec11d11d0c5c6896d0cf
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 391a22bac0fdafcc528ae60394cf4fde8def9c9d
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 7b30608cb81f2a3d1bbf764bb87815e59de214f4ff146a0bd09721070ccf13f2bc64c072b6735f6c12039e49222c09fe7e1c96f81edc3edb2e53c4693444964e
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 03466234cd8842f36e3f86ab48828077013cd9d8c33a4304b77e42ffbb0bbcf26959829a0c11e644750e9310d16e5ee4958fd7ab7b9eae45fc528389a42d5f44
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/lib/Zeta/plugins/weather.rb
    CHANGED
    
    | 
         @@ -159,7 +159,7 @@ module Plugins 
     | 
|
| 
       159 
159 
     | 
    
         
             
                  data.ac = ac
         
     | 
| 
       160 
160 
     | 
    
         
             
                  current = data.current_observation
         
     | 
| 
       161 
161 
     | 
    
         
             
                  alerts = data.alerts.empty? ? 'none' : data.alerts.map {|l| l['type']}.join(',')
         
     | 
| 
       162 
     | 
    
         
            -
                  pressure_si = Unitwise(current. 
     | 
| 
      
 162 
     | 
    
         
            +
                  pressure_si = Unitwise((current.pressure_in.to_f)+14.7, '[psi]').convert_to('kPa').to_f.round(2)
         
     | 
| 
       163 
163 
     | 
    
         | 
| 
       164 
164 
     | 
    
         
             
                  data.reply = "WU ∴ #{ac.name}, #{ac.c} " \
         
     | 
| 
       165 
165 
     | 
    
         
             
                              "≈ #{current.weather} #{current.temperature_string} " \
         
     | 
| 
         @@ -184,6 +184,8 @@ module Plugins 
     | 
|
| 
       184 
184 
     | 
    
         
             
                  ac = ac.results[0]
         
     | 
| 
       185 
185 
     | 
    
         
             
                  lat = ac.geometry.location.lat
         
     | 
| 
       186 
186 
     | 
    
         
             
                  lon = ac.geometry.location.lng
         
     | 
| 
      
 187 
     | 
    
         
            +
             
     | 
| 
      
 188 
     | 
    
         
            +
                  # Get Data
         
     | 
| 
       187 
189 
     | 
    
         
             
                  data = JSON.parse(
         
     | 
| 
       188 
190 
     | 
    
         
             
                      open(
         
     | 
| 
       189 
191 
     | 
    
         
             
                          URI.encode("https://api.openweathermap.org/data/2.5/weather?lat=#{lat}&lon=#{lon}&APPID=#{Config.secrets[:owm]}")
         
     | 
| 
         @@ -192,13 +194,13 @@ module Plugins 
     | 
|
| 
       192 
194 
     | 
    
         
             
                  )
         
     | 
| 
       193 
195 
     | 
    
         | 
| 
       194 
196 
     | 
    
         
             
                  temp = Unitwise(data.main.temp, 'K') # Data is given in kelvin
         
     | 
| 
       195 
     | 
    
         
            -
                  pressure = Unitwise(data.main.pressure, ' 
     | 
| 
      
 197 
     | 
    
         
            +
                  pressure = Unitwise((data.main.pressure.to_f/10)+101, 'kPa')
         
     | 
| 
       196 
198 
     | 
    
         
             
                  wind = Unitwise(data.wind.speed, 'kilometer')
         
     | 
| 
       197 
199 
     | 
    
         | 
| 
       198 
     | 
    
         
            -
                  data.reply = "OWM ∴ #{ac. 
     | 
| 
      
 200 
     | 
    
         
            +
                  data.reply = "OWM ∴ #{ac.formatted_address} " \
         
     | 
| 
       199 
201 
     | 
    
         
             
                              "≈ #{data.weather[0].description},  #{temp.convert_to('[degF]').to_i.round(2)} F (#{temp.convert_to('Cel').to_i.round(2)} C) " \
         
     | 
| 
       200 
202 
     | 
    
         
             
                              "≈ Humidity: #{data.main.humidity}% " \
         
     | 
| 
       201 
     | 
    
         
            -
                              "≈ Pressure: #{pressure. 
     | 
| 
      
 203 
     | 
    
         
            +
                              "≈ Pressure: #{pressure.convert_to('[psi]').to_f.round(2)} psi (#{pressure.convert_to('kPa').to_f} kPa) " \
         
     | 
| 
       202 
204 
     | 
    
         
             
                              "≈ Wind: #{wind.convert_to('mile').to_i.round(2)} mph (#{wind.to_i.round(2)} km/h) ∴"
         
     | 
| 
       203 
205 
     | 
    
         | 
| 
       204 
206 
     | 
    
         
             
                  return data
         
     | 
| 
         @@ -218,27 +220,27 @@ module Plugins 
     | 
|
| 
       218 
220 
     | 
    
         
             
                  lon = ac.geometry.location.lng
         
     | 
| 
       219 
221 
     | 
    
         | 
| 
       220 
222 
     | 
    
         
             
                  data = JSON.parse(
         
     | 
| 
       221 
     | 
    
         
            -
             
     | 
| 
       222 
     | 
    
         
            -
             
     | 
| 
       223 
     | 
    
         
            -
             
     | 
| 
       224 
     | 
    
         
            -
             
     | 
| 
      
 223 
     | 
    
         
            +
                      open(
         
     | 
| 
      
 224 
     | 
    
         
            +
                          URI.encode("https://api.darksky.net/forecast/#{Config.secrets[:darksky]}/#{lat},#{lon}")
         
     | 
| 
      
 225 
     | 
    
         
            +
                      ).read,
         
     | 
| 
      
 226 
     | 
    
         
            +
                      object_class: OpenStruct
         
     | 
| 
       225 
227 
     | 
    
         
             
                  )
         
     | 
| 
       226 
228 
     | 
    
         
             
                  data.ac = ac
         
     | 
| 
       227 
229 
     | 
    
         
             
                  current = data.currently
         
     | 
| 
       228 
230 
     | 
    
         
             
                  alerts = data.alerts.count rescue 0
         
     | 
| 
       229 
231 
     | 
    
         
             
                  c = Unitwise(current.temperature, '[degF]').convert_to('Cel').to_i
         
     | 
| 
       230 
232 
     | 
    
         
             
                  c_feels = Unitwise(current.apparentTemperature, '[degF]').convert_to('Cel').to_i
         
     | 
| 
       231 
     | 
    
         
            -
                  p = Unitwise(current.pressure, ' 
     | 
| 
      
 233 
     | 
    
         
            +
                  p = Unitwise((current.pressure.to_f/10)+101, 'kPa')
         
     | 
| 
       232 
234 
     | 
    
         
             
                  gusts = Unitwise(current.windGust, 'mile').convert_to('kilometer').to_i
         
     | 
| 
       233 
235 
     | 
    
         | 
| 
       234 
236 
     | 
    
         
             
                  tempstring = "#{current.temperature.to_i} F (#{c} C)"
         
     | 
| 
       235 
237 
     | 
    
         
             
                  feelslike = "#{current.apparentTemperature.to_i} F (#{c_feels} C)"
         
     | 
| 
       236 
238 
     | 
    
         | 
| 
       237 
     | 
    
         
            -
                  data.reply = "DS ∴ #{ac. 
     | 
| 
      
 239 
     | 
    
         
            +
                  data.reply = "DS ∴ #{ac.formatted_address} " \
         
     | 
| 
       238 
240 
     | 
    
         
             
                              "≈ #{current.summary} #{tempstring} " \
         
     | 
| 
       239 
241 
     | 
    
         
             
                              "≈ Feels like #{feelslike} " \
         
     | 
| 
       240 
242 
     | 
    
         
             
                              "≈ Humidity: #{current.relative_humidity} " \
         
     | 
| 
       241 
     | 
    
         
            -
                              "≈ Pressure: #{ 
     | 
| 
      
 243 
     | 
    
         
            +
                              "≈ Pressure: #{p.convert_to('[psi]').to_f.round(2)} psi (#{p.to_f} kPa) " \
         
     | 
| 
       242 
244 
     | 
    
         
             
                              "≈ Wind: gusts upto #{current.windGust} mph (#{gusts} km/h) ≈ Alerts: #{alerts} ∴"
         
     | 
| 
       243 
245 
     | 
    
         | 
| 
       244 
246 
     | 
    
         
             
                    return data
         
     | 
| 
         @@ -276,14 +278,13 @@ module Plugins 
     | 
|
| 
       276 
278 
     | 
    
         
             
                  temp = "#{f.round(2)} F (#{data.temperature.value.to_i.round(2)} C) "
         
     | 
| 
       277 
279 
     | 
    
         
             
                  wind = "Gusts: #{data.windGust.value} avg: #{data.windSpeed.value.to_i.round(2)}"
         
     | 
| 
       278 
280 
     | 
    
         
             
                  feelslike = "#{data.windChill.value.to_i.round(2)} C"
         
     | 
| 
       279 
     | 
    
         
            -
                   
     | 
| 
       280 
     | 
    
         
            -
                  pressure = (data.barometricPressure.value.to_i / 100).round(2)
         
     | 
| 
      
 281 
     | 
    
         
            +
                  pressure = Unitwise(data.barometricPressure.value.to_f+101325, 'Pa')
         
     | 
| 
       281 
282 
     | 
    
         | 
| 
       282 
     | 
    
         
            -
                  data.reply = "NOAA ∴ #{ac. 
     | 
| 
      
 283 
     | 
    
         
            +
                  data.reply = "NOAA ∴ #{ac.formatted_address} " \
         
     | 
| 
       283 
284 
     | 
    
         
             
                              "≈ #{data.textDescription} #{temp} " \
         
     | 
| 
       284 
285 
     | 
    
         
             
                              "≈ Feels like #{feelslike} " \
         
     | 
| 
       285 
286 
     | 
    
         
             
                              "≈ Humidity: #{data.relativeHumidity.value.round(2)} " \
         
     | 
| 
       286 
     | 
    
         
            -
                              "≈ Pressure: #{ 
     | 
| 
      
 287 
     | 
    
         
            +
                              "≈ Pressure: #{pressure.convert_to('[psi]').to_f.round(2)} psi (#{pressure.convert_to('kPa').to_f} kPa) " \
         
     | 
| 
       287 
288 
     | 
    
         
             
                              "≈ Wind: #{wind} ≈ Alerts:  ∴"
         
     | 
| 
       288 
289 
     | 
    
         
             
                  return data
         
     | 
| 
       289 
290 
     | 
    
         
             
                # rescue
         
     | 
    
        data/lib/Zeta/version.rb
    CHANGED