google-map-weather-intregration 1.2 → 1.3.0

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
- SHA1:
3
- metadata.gz: 793df577b1bfa835ba7d8c1433b091cf6a01d2dc
4
- data.tar.gz: 244670621953810bf9fb311c46e944899b889eea
2
+ SHA256:
3
+ metadata.gz: 247bc237a000084afb63310396e32502bd6a0414f1112074ea16f1bc51c13652
4
+ data.tar.gz: 0bb58446fb692e6b77f0eab06e344cc2c163ea9145040fb711ba3a6b1d3187b2
5
5
  SHA512:
6
- metadata.gz: 5b188bbef6b7afba7789e7318a1e2acdedcf3dd2ee0afdc955260d51a021149f7592d724194300dd8a3acbce291720ef097e6e568b7bc83b2c1ceed8edcbfcc4
7
- data.tar.gz: 37808a48f14dd6d641fd3d3578304d51081f5fc691c2e183da8ee1ead3a246fb60ad3d6c41960676e9d5ab5673a0e0f98ef212de610a4d3c4910f7fa3c707bf7
6
+ metadata.gz: 87f31f7669b53c7f189ef3f836352cfb02e58c7a7d3503f06751c3bd13823230391df4199d863c2966b7f8bae9f6447b00d11d65a1cf6fa70c744357258ccd50
7
+ data.tar.gz: 856e096388d1a1d27440de49432c7348c5050408d932593f884f64351891ff4f2a6a30d78dd1ee736fa417456e35825a5c7bcdb70c29d22bbb004d43ea65f692
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ > ⚠️ **DEPRECATED** — The MyWeather2 API this gem depends on has been shut down since ~2020. All API calls will fail. Please migrate to [open-meteo](https://open-meteo.com/) (free, no API key) or [OpenWeatherMap](https://openweathermap.org/).
2
+
3
+ # google-map-weather-intregration
4
+
5
+ A Ruby gem to fetch weather data by geographic coordinates and surface it alongside Google Maps in Rails applications. Powered by the [MyWeather2](http://www.myweather2.com/developer/) API.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your `Gemfile`:
10
+
11
+ ```ruby
12
+ gem 'google-map-weather-intregration'
13
+ ```
14
+
15
+ Then run:
16
+
17
+ ```bash
18
+ bundle install
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ Initialize with your MyWeather2 API key and a lat/lng coordinate:
24
+
25
+ ```ruby
26
+ weather = WeatherApi.new("YOUR_API_KEY", 48.8584, 2.2945)
27
+ ```
28
+
29
+ ### Current conditions
30
+
31
+ ```ruby
32
+ weather.current # => raw current weather hash
33
+ ```
34
+
35
+ ### Forecast
36
+
37
+ ```ruby
38
+ weather.forecast # => array of forecast days
39
+ weather.next_day # => forecast hash for the next day
40
+ ```
41
+
42
+ ### Convenience methods
43
+
44
+ ```ruby
45
+ weather.day_max_temprature # => "22 C"
46
+ weather.day_type # => "Partly Cloudy"
47
+ weather.wind_speed # => "15 km/h"
48
+ weather.wind_direction # => "NW"
49
+ weather.wind_degree # => "315"
50
+ ```
51
+
52
+ ## Dependencies
53
+
54
+ - [nokogiri](https://nokogiri.org/)
@@ -0,0 +1,19 @@
1
+ require_relative "lib/weather_api/version"
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "google-map-weather-intregration"
5
+ spec.version = WeatherApi::VERSION
6
+ spec.authors = ["Abhishek Sharma"]
7
+ spec.email = ["abhsss96@gmail.com"]
8
+ spec.summary = "Fetch weather data by coordinates for use with Google Maps"
9
+ spec.description = "Fetches current weather and forecast data by geographic coordinates using the MyWeather2 API."
10
+ spec.homepage = "https://github.com/abhsss96/google-map-weather-intregration"
11
+ spec.license = "MIT"
12
+ spec.required_ruby_version = ">= 2.7"
13
+
14
+ spec.files = Dir["lib/**/*", "README.md", "*.gemspec"]
15
+ spec.require_paths = ["lib"]
16
+
17
+ spec.add_development_dependency "rspec", "~> 3.12"
18
+ spec.add_development_dependency "webmock", "~> 3.0"
19
+ end
@@ -0,0 +1,3 @@
1
+ class WeatherApi
2
+ VERSION = "1.3.0"
3
+ end
data/lib/weather_api.rb CHANGED
@@ -1,15 +1,18 @@
1
+ require "open-uri"
2
+ require "json"
3
+ require_relative "weather_api/version"
4
+
1
5
  class WeatherApi
6
+ FORECAST_URL = "http://www.myweather2.com/developer/forecast.ashx?output=json"
2
7
 
3
- require 'nokogiri'
4
- require 'open-uri'
5
- require 'json'
6
8
  def initialize(key, lat, lng)
7
-
8
- url = 'http://www.myweather2.com/developer/forecast.ashx?output=json'
9
- uri = URI.parse(url+"&uac=#{key}&query=#{lat},#{lng}")
10
- result = open(uri).read
9
+ warn "[DEPRECATION] google-map-weather-intregration: The MyWeather2 API (myweather2.com) " \
10
+ "has been shut down. This gem is no longer functional. " \
11
+ "Please migrate to the open-meteo gem (https://github.com/open-meteo/ruby-sdk) or openweathermap."
12
+ uri = URI.parse(FORECAST_URL + "&uac=#{key}&query=#{lat},#{lng}")
13
+ result = URI.open(uri).read
11
14
  unless result == "Unable to find any matching weather location to the query submitted!"
12
- @response = JSON.parse(result)
15
+ @response = JSON.parse(result)
13
16
  else
14
17
  puts "Invalid Location"
15
18
  end
@@ -20,11 +23,11 @@ class WeatherApi
20
23
  end
21
24
 
22
25
  def current
23
- response['weather']['curren_weather']
26
+ response["weather"]["curren_weather"]
24
27
  end
25
28
 
26
29
  def forecast
27
- response['weather']['forecast']
30
+ response["weather"]["forecast"]
28
31
  end
29
32
 
30
33
  def next_day
@@ -36,23 +39,22 @@ class WeatherApi
36
39
  end
37
40
 
38
41
  def day_type
39
- next_day['weather_text']
42
+ next_day["weather_text"]
40
43
  end
41
44
 
42
45
  def wind
43
- next_day['day'][0]['wind']
46
+ next_day["day"][0]["wind"]
44
47
  end
45
48
 
46
49
  def wind_direction
47
- wind['dir']
50
+ wind["dir"]
48
51
  end
49
52
 
50
53
  def wind_degree
51
- wind['dir_degree']
54
+ wind["dir_degree"]
52
55
  end
53
56
 
54
57
  def wind_speed
55
58
  "#{wind['speed']} #{wind['wind_unit']}"
56
59
  end
57
-
58
60
  end
metadata CHANGED
@@ -1,45 +1,76 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-map-weather-intregration
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.2'
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abhishek Sharma
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-24 00:00:00.000000000 Z
12
- dependencies: []
13
- description: Gem to use weather api in google maps.
14
- email: abhishek.sharma@medma.in
11
+ date: 2026-05-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.12'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: webmock
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ description: Fetches current weather and forecast data by geographic coordinates using
42
+ the MyWeather2 API.
43
+ email:
44
+ - abhsss96@gmail.com
15
45
  executables: []
16
46
  extensions: []
17
47
  extra_rdoc_files: []
18
48
  files:
49
+ - README.md
50
+ - google-map-weather-intregration.gemspec
19
51
  - lib/weather_api.rb
20
- homepage: https://rubygems.org/gems/google-map-weather-intregration
52
+ - lib/weather_api/version.rb
53
+ homepage: https://github.com/abhsss96/google-map-weather-intregration
21
54
  licenses:
22
- - NONE
55
+ - MIT
23
56
  metadata: {}
24
- post_install_message:
57
+ post_install_message:
25
58
  rdoc_options: []
26
59
  require_paths:
27
60
  - lib
28
61
  required_ruby_version: !ruby/object:Gem::Requirement
29
62
  requirements:
30
- - - '>='
63
+ - - ">="
31
64
  - !ruby/object:Gem::Version
32
- version: '0'
65
+ version: '2.7'
33
66
  required_rubygems_version: !ruby/object:Gem::Requirement
34
67
  requirements:
35
- - - '>='
68
+ - - ">="
36
69
  - !ruby/object:Gem::Version
37
70
  version: '0'
38
71
  requirements: []
39
- rubyforge_project:
40
- rubygems_version: 2.3.0
41
- signing_key:
72
+ rubygems_version: 3.5.22
73
+ signing_key:
42
74
  specification_version: 4
43
- summary: Hello! This is library to get the weather info from latitude and longitude.
75
+ summary: Fetch weather data by coordinates for use with Google Maps
44
76
  test_files: []
45
- has_rdoc: