easy_weather 1.0.2 → 1.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 970434a818853929fc42f85dee9d6d4ba48899314927d3e228d9a2a50a478669
4
- data.tar.gz: 1eadc9ef27e71b416f5385980581af53cf642f99f1a4dd44b8dae0e1967bb7b8
3
+ metadata.gz: d1c944ba34e8396104184ad4812e8e322e8a5490e9515382dcc63f09df6a7093
4
+ data.tar.gz: fb72697157738cd53967926e2f5dc843cf12e7b9b29c7fc593f727b53d214def
5
5
  SHA512:
6
- metadata.gz: 74cd19009ce5c45726396d0458ad28d812550eb74fd6b95fe8b14b628fda4935b15ed8db610946de895d70f1e03b5637c42ce26b8b475ed41693dc8077cb21c4
7
- data.tar.gz: 40fca591c20037fe9fde417e35a7fa0dd7d40bfe9d8951b21a58defc1568dbe2a0b11a1373f570cb613a08578fa9a321253d34f3bc05a76808cf13deaf54017a
6
+ metadata.gz: 79f63d06e494c313cc5c9155f2057555fabd09fe082103fdf63680ecfbed10eab461fa1e53340744207f8fb1ebec151ef94ffc3bc9f5245a8ff6a60b05d3d72c
7
+ data.tar.gz: a34f4aece0c1d549a9cc501a5eacd12ad680490610b21153a6af74c88fb78da736f61369b4520e51f007e473f789365533615202a196f9a830b7257bdb24370b
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EasyWeather
4
- VERSION = "1.0.2"
4
+ VERSION = "1.0.3"
5
5
  end
@@ -41,24 +41,26 @@ class Weather
41
41
  pressure: data["main"]["pressure"],
42
42
  visibility: data["visibility"]
43
43
  }
44
- "Humidy: #{data_hash[:humidity]}%, pressure: #{data_hash[:pressure]}hPa, visibility: #{data_hash[:visibility]} meters"
44
+ "Humidy: #{data_hash[:humidity]}%, pressure: #{data_hash[:pressure]}hPa,
45
+ visibility: #{data_hash[:visibility]} meters"
45
46
  end
46
47
 
47
48
  private
48
49
 
49
50
  def get_general_data(city)
50
- response =
51
- HTTParty.get("#{BASE_URL}weather?q=#{city}
52
- &units=metric&APPID=#{ENV["EASY_WEATHER"]}")
53
-
54
- JSON.parse(response.body)
51
+ url = "#{BASE_URL}weather?q=#{city}
52
+ &units=metric&APPID=#{ENV["EASY_WEATHER"]}"
53
+ fetch_data(url)
55
54
  end
56
55
 
57
56
  def get_forecast_data(days, city)
58
- response =
59
- HTTParty.get("#{BASE_URL}forecast?q=#{city}
60
- &units=metric&cnt=#{days}&appid=#{ENV["EASY_WEATHER"]}")
61
-
57
+ url = "#{BASE_URL}forecast?q=#{city}
58
+ &units=metric&cnt=#{days}&appid=#{ENV["EASY_WEATHER"]}"
59
+ fetch_data(url)
60
+ end
61
+
62
+ def fetch_data(url)
63
+ response = HTTParty.get(url)
62
64
  JSON.parse(response.body)
63
65
  end
64
66
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_weather
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alejandro Tinoco