google-map-weather-intregration 1.2 → 1.2.1

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: 14592be7137415cf03d18c1b10e35ab2ddc74bd32410e17c7c23d4280458a5d9
4
+ data.tar.gz: 724992973813cfb38bce1bfc7d79236e725bbe89e1342e0d5eb64976686e0380
5
5
  SHA512:
6
- metadata.gz: 5b188bbef6b7afba7789e7318a1e2acdedcf3dd2ee0afdc955260d51a021149f7592d724194300dd8a3acbce291720ef097e6e568b7bc83b2c1ceed8edcbfcc4
7
- data.tar.gz: 37808a48f14dd6d641fd3d3578304d51081f5fc691c2e183da8ee1ead3a246fb60ad3d6c41960676e9d5ab5673a0e0f98ef212de610a4d3c4910f7fa3c707bf7
6
+ metadata.gz: a6373049003db73acd4589f98d136df133a505211f68b5529199230e2d1a4fe8646065b59a239a82129c419158a6a562b170cab022e4ca98f6454e049e52b815
7
+ data.tar.gz: c82f4c328280b3e228802e61657bcbe5608dd878610d00d1034b504171c444c04050faeccf9fce1dd530045f4b79e3400323d4be8264495e86f6a2f3145ca43e
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # google-map-weather-intregration
2
+
3
+ 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.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your `Gemfile`:
8
+
9
+ ```ruby
10
+ gem 'google-map-weather-intregration'
11
+ ```
12
+
13
+ Then run:
14
+
15
+ ```bash
16
+ bundle install
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ Initialize with your MyWeather2 API key and a lat/lng coordinate:
22
+
23
+ ```ruby
24
+ weather = WeatherApi.new("YOUR_API_KEY", 48.8584, 2.2945)
25
+ ```
26
+
27
+ ### Current conditions
28
+
29
+ ```ruby
30
+ weather.current # => raw current weather hash
31
+ ```
32
+
33
+ ### Forecast
34
+
35
+ ```ruby
36
+ weather.forecast # => array of forecast days
37
+ weather.next_day # => forecast hash for the next day
38
+ ```
39
+
40
+ ### Convenience methods
41
+
42
+ ```ruby
43
+ weather.day_max_temprature # => "22 C"
44
+ weather.day_type # => "Partly Cloudy"
45
+ weather.wind_speed # => "15 km/h"
46
+ weather.wind_direction # => "NW"
47
+ weather.wind_degree # => "315"
48
+ ```
49
+
50
+ ## Dependencies
51
+
52
+ - [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.2.1"
3
+ end
data/lib/weather_api.rb CHANGED
@@ -1,15 +1,15 @@
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
+ uri = URI.parse(FORECAST_URL + "&uac=#{key}&query=#{lat},#{lng}")
10
+ result = URI.open(uri).read
11
11
  unless result == "Unable to find any matching weather location to the query submitted!"
12
- @response = JSON.parse(result)
12
+ @response = JSON.parse(result)
13
13
  else
14
14
  puts "Invalid Location"
15
15
  end
@@ -20,11 +20,11 @@ class WeatherApi
20
20
  end
21
21
 
22
22
  def current
23
- response['weather']['curren_weather']
23
+ response["weather"]["curren_weather"]
24
24
  end
25
25
 
26
26
  def forecast
27
- response['weather']['forecast']
27
+ response["weather"]["forecast"]
28
28
  end
29
29
 
30
30
  def next_day
@@ -36,23 +36,22 @@ class WeatherApi
36
36
  end
37
37
 
38
38
  def day_type
39
- next_day['weather_text']
39
+ next_day["weather_text"]
40
40
  end
41
41
 
42
42
  def wind
43
- next_day['day'][0]['wind']
43
+ next_day["day"][0]["wind"]
44
44
  end
45
45
 
46
46
  def wind_direction
47
- wind['dir']
47
+ wind["dir"]
48
48
  end
49
49
 
50
50
  def wind_degree
51
- wind['dir_degree']
51
+ wind["dir_degree"]
52
52
  end
53
53
 
54
54
  def wind_speed
55
55
  "#{wind['speed']} #{wind['wind_unit']}"
56
56
  end
57
-
58
57
  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.2.1
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: