open_weather_client 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -0
- data/CHANGES.md +10 -1
- data/Gemfile +4 -2
- data/README.md +41 -1
- data/Rakefile +5 -3
- data/bin/console +1 -0
- data/lib/open_weather_client/caching/memory.rb +49 -0
- data/lib/open_weather_client/caching.rb +90 -0
- data/lib/open_weather_client/configuration.rb +39 -4
- data/lib/open_weather_client/request.rb +48 -0
- data/lib/open_weather_client/version.rb +5 -1
- data/lib/open_weather_client/weather.rb +37 -24
- data/lib/open_weather_client.rb +41 -10
- data/open_weather_client.gemspec +25 -27
- metadata +28 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dec682ab56d84b58d75c7cee7e1741ea87e5a38e8cedec1ef927b35014108be
|
4
|
+
data.tar.gz: ed092b5ca8ddeb5bffdb77d1abcacbb52cc5c37a317cee41aacd4063fd680a25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84de4f4266c121d44033694c6dbca2519db1f87976dd420ec64711831e45957ceb827a33b60a30a045ac6b7734760c85f7404654332c4d22fd9a7fb1423c05be
|
7
|
+
data.tar.gz: 037bcb2ff6e0fdf53023520b290fc0cfc821c0184a94208dfd9d108a86852998d5af7ff23a1aa4d8ceb73f2dacc46d9bb64d0e01a7e096c198ff121aab7a2fff
|
data/.rubocop.yml
ADDED
data/CHANGES.md
CHANGED
@@ -1,8 +1,17 @@
|
|
1
1
|
# Open Weather Client Changelog
|
2
2
|
|
3
|
+
## 0.1.3
|
4
|
+
Re-release of 0.1.2 since this version was released from an incorrect branch.
|
5
|
+
|
6
|
+
## 0.1.2 [yanked]
|
7
|
+
- Enable Rubocop Linter
|
8
|
+
- Add caching of requests (#1)
|
9
|
+
- Add location quantization (#3)
|
10
|
+
- Reset gem before every example in spec (#2)
|
11
|
+
|
3
12
|
## 0.1.1
|
4
13
|
- Raise `OpenWeatherClient::AuthenticationError` if the request is not authorized
|
5
|
-
-
|
14
|
+
- Raise `RangeError` if latitude or longitude is out of the allowed range
|
6
15
|
- Raise `Faraday::Error` if the request fails otherwise
|
7
16
|
|
8
17
|
## 0.1.0
|
data/Gemfile
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
6
|
|
5
7
|
# Specify your gem's dependencies in open_weather_client.gemspec
|
6
8
|
gemspec
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/open_weather_client.svg)](https://badge.fury.io/rb/open_weather_client)
|
4
4
|
![RSpec](https://github.com/qurasoft/open_weather_client/actions/workflows/ruby.yml/badge.svg)
|
5
5
|
|
6
|
-
Welcome to Open Weather Client. This gem allows you to easily
|
6
|
+
Welcome to Open Weather Client. This gem allows you to easily request weather information from OpenWeatherMap.
|
7
7
|
It integrates in your rails project, when you are using bundler or even in plain ruby projects.
|
8
8
|
|
9
9
|
## Installation
|
@@ -58,6 +58,46 @@ OpenWeatherClient.configure do |config|
|
|
58
58
|
end
|
59
59
|
```
|
60
60
|
|
61
|
+
### Caching
|
62
|
+
By default Open Weather Client does not cache any data and every request will be send to the OpenWeatherMap servers.
|
63
|
+
|
64
|
+
To speed up requests and reduce the number network requests caching can be enabled.
|
65
|
+
When Open Weather Client is reset, the cache is also reset.
|
66
|
+
The cache may be accessed directly through the singleton `OpenWeatherClient.cache`.
|
67
|
+
|
68
|
+
Whether requests are only performed when the requested time is within the last hour.
|
69
|
+
If caching is enabled, requests with a time older than one hour might still be answered with a response.
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
OpenWeatherClient.configure do |config|
|
73
|
+
config.caching = OpenWeatherClient::Caching::Memory
|
74
|
+
config.max_memory_entries = 100 # Maximum number of entries in memory cache
|
75
|
+
end
|
76
|
+
```
|
77
|
+
|
78
|
+
#### Memory Caching
|
79
|
+
`OpenWeatherClient` supports simple in memory caching.
|
80
|
+
A hash is used to store and look up the cached responses.
|
81
|
+
|
82
|
+
#### Custom Caching
|
83
|
+
To implement custom caching, the interface of `OpenWeatherClient::Caching` is used.
|
84
|
+
A custom caching solution must implement its specific `caching_get(key)`, `caching_store(key, data)` and `present?(key)` methods.
|
85
|
+
|
86
|
+
### Spatial Quantization
|
87
|
+
Since weather is more often than not a wider phenomenon, the high resolution location data, commonly available today may interfere with the performance even when using caching.
|
88
|
+
Caching uses the full resolution of the location data.
|
89
|
+
By default no quantization is performed.
|
90
|
+
|
91
|
+
OpenWeatherClient allows defining a quantization function to transform the latitude and longitude data before making requests or hitting the cache.
|
92
|
+
The quantization receives latitude and longitude.
|
93
|
+
The result is coerced back into latitude and longitude.
|
94
|
+
|
95
|
+
```ruby
|
96
|
+
OpenWeatherClient.configure do |config|
|
97
|
+
config.spatial_quantization = proc { |lat, lon| [lat.round(2), lon.round(2)] }
|
98
|
+
end
|
99
|
+
```
|
100
|
+
|
61
101
|
## Development
|
62
102
|
|
63
103
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenWeatherClient
|
4
|
+
class Caching
|
5
|
+
##
|
6
|
+
# Memory cache of OpenWeatherMap requests
|
7
|
+
#
|
8
|
+
# The requests are cached in memory up to the number specified in config.max_memory_entries.
|
9
|
+
# When the limit is reached the least recently used entry is evicted.
|
10
|
+
class Memory < OpenWeatherClient::Caching
|
11
|
+
# Memory cache to store a hash of keys and request data
|
12
|
+
attr :memory_cache
|
13
|
+
# Key registry of the memory cache. The first entry is the key of the least recently accessed data
|
14
|
+
attr :memory_keys
|
15
|
+
|
16
|
+
##
|
17
|
+
# Initialize an empty cache
|
18
|
+
def initialize
|
19
|
+
super
|
20
|
+
@memory_cache = {}
|
21
|
+
@memory_keys = []
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def caching_get(key)
|
27
|
+
@memory_keys.delete(key)
|
28
|
+
@memory_keys << key if @memory_cache.key? key
|
29
|
+
@memory_cache[key]
|
30
|
+
end
|
31
|
+
|
32
|
+
def caching_store(key, data)
|
33
|
+
@memory_cache[key] = data
|
34
|
+
@memory_keys.delete(key)
|
35
|
+
@memory_keys << key
|
36
|
+
|
37
|
+
if @memory_keys.count > OpenWeatherClient.configuration.max_memory_entries
|
38
|
+
@memory_cache.delete(@memory_keys.shift)
|
39
|
+
end
|
40
|
+
|
41
|
+
data
|
42
|
+
end
|
43
|
+
|
44
|
+
def present?(key)
|
45
|
+
@memory_keys.include?(key)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenWeatherClient
|
4
|
+
##
|
5
|
+
# Caching of OpenWeatherMap requests
|
6
|
+
#
|
7
|
+
# The entries are cached according to latitude, longitude and time of the request.
|
8
|
+
# The time is clamped to the current hour
|
9
|
+
#
|
10
|
+
# This is the caching interface and equals a none cache. Get requests raise an error.
|
11
|
+
class Caching
|
12
|
+
##
|
13
|
+
# Get an entry out of the cache defined by its +lat+, +lon+ and +time+.
|
14
|
+
#
|
15
|
+
# @param lat[Float] latitude of the requests location
|
16
|
+
# @param lon[Float] longitude of the requests location
|
17
|
+
# @param time[Time] time of the request
|
18
|
+
#
|
19
|
+
# @raise [KeyError] if no entry is present
|
20
|
+
# @raise [NotImplementedError] if an unsupported caching method is used
|
21
|
+
#
|
22
|
+
# @return [Hash] the stored data
|
23
|
+
def get(lat:, lon:, time:)
|
24
|
+
key = cache_key(lat, lon, time)
|
25
|
+
raise KeyError unless present?(key)
|
26
|
+
|
27
|
+
caching_get(key)
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
# Store the data by its +lat+, +lon+ and +time+.
|
32
|
+
#
|
33
|
+
# @param data[Hash] data to be stored, must be able to be formatted and parsed as text
|
34
|
+
# @param lat[Float] latitude of the requests location
|
35
|
+
# @param lon[Float] longitude of the requests location
|
36
|
+
# @param time[Time] time of the request
|
37
|
+
#
|
38
|
+
# @return [Hash] the input data
|
39
|
+
def store(data:, lat:, lon:, time:)
|
40
|
+
key = cache_key(lat, lon, time)
|
41
|
+
|
42
|
+
caching_store(key, data)
|
43
|
+
|
44
|
+
data
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
##
|
50
|
+
# Calculate the key for storage in the cache
|
51
|
+
#
|
52
|
+
# @param lat[Float] latitude of the requests location
|
53
|
+
# @param lon[Float] longitude of the requests location
|
54
|
+
# @param time[Time] time of the request
|
55
|
+
def cache_key(lat, lon, time)
|
56
|
+
"#{lat}_#{lon}_#{time.strftime('%Y-%m-%dT%H')}"
|
57
|
+
end
|
58
|
+
|
59
|
+
##
|
60
|
+
# Read an entry out of the memory cache
|
61
|
+
#
|
62
|
+
# @param key[String] key into the cache. Is stored at the end of the key registry
|
63
|
+
#
|
64
|
+
# @return [Hash] the stored data
|
65
|
+
def caching_get(key)
|
66
|
+
raise NotImplementedError
|
67
|
+
end
|
68
|
+
|
69
|
+
##
|
70
|
+
# Store an entry in the memory cache
|
71
|
+
#
|
72
|
+
# Evicts the entry with the least recent access if the memory cache is full
|
73
|
+
#
|
74
|
+
# @param key[String] key into the cache. Is stored at the end of the key registry
|
75
|
+
# @param data[Hash] data to be stored, must be able to be formatted and parsed as text
|
76
|
+
#
|
77
|
+
# @return [Hash] the input data
|
78
|
+
def caching_store(key, data)
|
79
|
+
data
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# Check whether a key is present in the cache
|
84
|
+
#
|
85
|
+
# @return always false when the cache method is not supported or caching is not enabled
|
86
|
+
def present?(_key)
|
87
|
+
false
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -1,18 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OpenWeatherClient
|
4
|
+
##
|
5
|
+
# Configuratin of OpenWeatherClient
|
2
6
|
class Configuration
|
3
|
-
|
7
|
+
# [String] API key to access OpenWeatherMap
|
8
|
+
attr_accessor :appid
|
9
|
+
# Caching method. One of :none, :memory
|
10
|
+
attr_reader :caching
|
11
|
+
# [String] Requested language of the result
|
12
|
+
attr_accessor :lang
|
13
|
+
# [Integer] Maximum allowed number of entries when using caching method :memory
|
14
|
+
attr_accessor :max_memory_entries
|
15
|
+
# [Proc] Quantization of latitude and longitude
|
16
|
+
attr_accessor :spatial_quantization
|
17
|
+
# [String] Requested units of the result
|
18
|
+
attr_accessor :units
|
19
|
+
# [String] Base URL of the requests to OpenWeatherMap
|
20
|
+
attr_accessor :url
|
21
|
+
# [String] User-Agent of the requests made to OpenWeatherMap
|
22
|
+
attr_accessor :user_agent
|
4
23
|
|
24
|
+
##
|
25
|
+
# Initialize a new Configuration with the default settings
|
5
26
|
def initialize
|
27
|
+
@caching = OpenWeatherClient::Caching.new
|
6
28
|
@lang = 'de'
|
29
|
+
@max_memory_entries = 10_000
|
7
30
|
@units = 'metric'
|
8
31
|
@url = 'https://api.openweathermap.org/data'
|
9
32
|
@user_agent = "Open Weather Client/#{OpenWeatherClient::VERSION}"
|
10
33
|
end
|
11
34
|
|
35
|
+
##
|
36
|
+
# Set the caching method
|
37
|
+
#
|
38
|
+
# @param cache_class[Class] class definition adhering to the OpenWeatherClient::Caching interface
|
39
|
+
def caching=(cache_class)
|
40
|
+
@caching = cache_class.new
|
41
|
+
end
|
42
|
+
|
43
|
+
##
|
44
|
+
# Load appid from Rails credentials
|
45
|
+
#
|
46
|
+
# Load the appid from Rails credentials using the top-level key 'open_weather_client'
|
47
|
+
#
|
48
|
+
# @raise [RuntimeError] if not using Rails
|
12
49
|
def load_from_rails_credentials
|
13
|
-
unless defined? Rails
|
14
|
-
raise RuntimeError, 'This method is only available in Ruby on Rails.'
|
15
|
-
end
|
50
|
+
raise 'This method is only available in Ruby on Rails.' unless defined? Rails
|
16
51
|
|
17
52
|
settings = Rails.application.credentials.open_weather_client!
|
18
53
|
self.appid = settings[:appid]
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'faraday'
|
4
|
+
|
5
|
+
module OpenWeatherClient
|
6
|
+
##
|
7
|
+
# Request the weather from OpenWeatherMap
|
8
|
+
class Request
|
9
|
+
##
|
10
|
+
# Request the current weather
|
11
|
+
#
|
12
|
+
# @param lat[Float] latitude of the requests location
|
13
|
+
# @param lon[Float] longitude of the requests location
|
14
|
+
# @param time[Time] time of the request
|
15
|
+
#
|
16
|
+
# @raise [AuthenticationError] if the request is not authorized, e.g in case the API key is not correct
|
17
|
+
# @raise [NotCurrentError] if the requested time is older than 1 hour
|
18
|
+
#
|
19
|
+
# @return the response body
|
20
|
+
def self.get(lat:, lon:, time: Time.now)
|
21
|
+
raise OpenWeatherClient::NotCurrentError if time < Time.now - 1 * 60 * 60
|
22
|
+
|
23
|
+
connection = Faraday.new(
|
24
|
+
url: OpenWeatherClient.configuration.url,
|
25
|
+
params: {
|
26
|
+
appid: OpenWeatherClient.configuration.appid,
|
27
|
+
lat: lat,
|
28
|
+
lon: lon,
|
29
|
+
lang: OpenWeatherClient.configuration.lang,
|
30
|
+
units: OpenWeatherClient.configuration.units
|
31
|
+
},
|
32
|
+
headers: {
|
33
|
+
'User-Agent': OpenWeatherClient.configuration.user_agent
|
34
|
+
}
|
35
|
+
) do |f|
|
36
|
+
f.response :raise_error
|
37
|
+
f.response :json
|
38
|
+
end
|
39
|
+
|
40
|
+
begin
|
41
|
+
response = connection.get('2.5/weather')
|
42
|
+
OpenWeatherClient.cache.store(lat: lat, lon: lon, data: response.body, time: time)
|
43
|
+
rescue Faraday::UnauthorizedError
|
44
|
+
raise OpenWeatherClient::AuthenticationError
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -1,34 +1,47 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module OpenWeatherClient
|
4
|
+
##
|
5
|
+
# Request weather information from OpenWeatherMap or the cache
|
4
6
|
class Weather
|
5
|
-
|
7
|
+
# [Float] latitude of the requested location
|
8
|
+
attr_accessor :lat
|
9
|
+
# [Float] longitude of the requested location
|
10
|
+
attr_accessor :lon
|
11
|
+
# [Time] time of the requested weather
|
12
|
+
attr_accessor :time
|
13
|
+
|
14
|
+
##
|
15
|
+
# Initialize a new Weather request
|
16
|
+
#
|
17
|
+
# @param lat[Float] latitude of the requests location
|
18
|
+
# @param lon[Float] longitude of the requests location
|
19
|
+
# @param time[Time] time of the request
|
20
|
+
#
|
21
|
+
# @raise [RangeError] if one +lat+ or +lon+ are out of the expected ranges
|
22
|
+
def initialize(lat:, lon:, time: Time.now)
|
23
|
+
if OpenWeatherClient.configuration.spatial_quantization.respond_to?(:call)
|
24
|
+
lat, lon = OpenWeatherClient.configuration.spatial_quantization.call(lat, lon)
|
25
|
+
end
|
26
|
+
|
6
27
|
raise RangeError unless (-90..90).member?(lat)
|
7
28
|
raise RangeError unless (-180..180).member?(lon)
|
8
29
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
lat: lat,
|
14
|
-
lon: lon,
|
15
|
-
lang: OpenWeatherClient.configuration.lang,
|
16
|
-
units: OpenWeatherClient.configuration.units
|
17
|
-
},
|
18
|
-
headers: {
|
19
|
-
'User-Agent': OpenWeatherClient.configuration.user_agent
|
20
|
-
}
|
21
|
-
) do |f|
|
22
|
-
f.response :raise_error
|
23
|
-
f.response :json
|
24
|
-
end
|
30
|
+
@lat = lat
|
31
|
+
@lon = lon
|
32
|
+
@time = time
|
33
|
+
end
|
25
34
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
35
|
+
##
|
36
|
+
# get the weather according to the specified parameters
|
37
|
+
#
|
38
|
+
# @raise [AuthenticationError] if the request is not authorized, e.g in case the API key is not correct
|
39
|
+
#
|
40
|
+
# @return the stored or received data
|
41
|
+
def get
|
42
|
+
OpenWeatherClient.cache.get(lat: lat, lon: lon, time: time)
|
43
|
+
rescue KeyError
|
44
|
+
OpenWeatherClient::Request.get(lat: lat, lon: lon)
|
32
45
|
end
|
33
46
|
end
|
34
47
|
end
|
data/lib/open_weather_client.rb
CHANGED
@@ -1,40 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'open_weather_client/caching'
|
1
4
|
require 'open_weather_client/configuration'
|
5
|
+
require 'open_weather_client/request'
|
2
6
|
require 'open_weather_client/version'
|
3
7
|
require 'open_weather_client/weather'
|
4
8
|
|
9
|
+
##
|
10
|
+
# Get weather data from OpenWeatherMap
|
5
11
|
module OpenWeatherClient
|
12
|
+
# Error during authentication with the OpenWeatherMap servers
|
6
13
|
class AuthenticationError < StandardError; end
|
7
14
|
|
15
|
+
# The rquested time is not current enough for getting weather data from the OpenWeatherMap server
|
16
|
+
class NotCurrentError < StandardError; end
|
17
|
+
|
8
18
|
class << self
|
9
|
-
|
19
|
+
# Caching singleton to access the cache
|
20
|
+
attr_writer :cache
|
21
|
+
# Configuration singleton to access the configuration
|
22
|
+
attr_writer :configuration
|
10
23
|
end
|
11
24
|
|
25
|
+
##
|
26
|
+
# Get the singleton cache instance
|
27
|
+
#
|
28
|
+
# @return [Caching] the cache
|
29
|
+
def self.cache
|
30
|
+
@cache ||= Caching.new
|
31
|
+
end
|
32
|
+
|
33
|
+
##
|
34
|
+
# Get the singleton configuration instance
|
35
|
+
#
|
36
|
+
# @return [Configuration] the configuration
|
12
37
|
def self.configuration
|
13
38
|
@configuration ||= Configuration.new
|
14
39
|
end
|
15
40
|
|
41
|
+
##
|
42
|
+
# Reset cache and configuration
|
16
43
|
def self.reset
|
44
|
+
@cache = Caching.new
|
17
45
|
@configuration = Configuration.new
|
18
46
|
end
|
19
47
|
|
48
|
+
##
|
49
|
+
# Configure OpenWeatherClient
|
20
50
|
def self.configure
|
21
51
|
yield configuration
|
22
52
|
end
|
23
53
|
|
54
|
+
##
|
55
|
+
# Get the project root
|
24
56
|
def self.project_root
|
25
|
-
if defined?(Rails)
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
if defined?(Bundler)
|
30
|
-
return Bundler.root
|
31
|
-
end
|
57
|
+
return Rails.root if defined?(Rails)
|
58
|
+
return Bundler.root if defined?(Bundler)
|
32
59
|
|
33
60
|
Dir.pwd
|
34
61
|
end
|
35
62
|
|
63
|
+
##
|
64
|
+
# Get the gem root
|
36
65
|
def self.gem_root
|
37
|
-
spec = Gem::Specification.find_by_name(
|
38
|
-
spec.gem_dir
|
66
|
+
spec = Gem::Specification.find_by_name('open_weather_client')
|
67
|
+
spec.gem_dir
|
68
|
+
rescue NoMethodError
|
69
|
+
project_root
|
39
70
|
end
|
40
71
|
end
|
data/open_weather_client.gemspec
CHANGED
@@ -1,43 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
|
-
lib = File.expand_path(
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
5
|
+
require 'open_weather_client/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
8
|
+
spec.name = 'open_weather_client'
|
8
9
|
spec.version = OpenWeatherClient::VERSION
|
9
|
-
spec.
|
10
|
-
spec.
|
10
|
+
spec.required_ruby_version = '>= 3.0'
|
11
|
+
spec.required_rubygems_version = '>= 2'
|
12
|
+
spec.authors = ['Lucas Keune']
|
13
|
+
spec.email = ['lucas.keune@qurasoft.de']
|
11
14
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
15
|
+
spec.summary = 'Access weather data from OpenWeatherMap'
|
16
|
+
spec.description = ''
|
17
|
+
spec.homepage = 'https://github.com/Qurasoft/open_weather_client'
|
18
|
+
spec.license = 'MIT'
|
16
19
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
21
|
-
spec.metadata["source_code_uri"] = "https://github.com/Qurasoft/open_weather_client"
|
22
|
-
spec.metadata["changelog_uri"] = "https://github.com/Qurasoft/open_weather_client/blob/main/CHANGES.md"
|
23
|
-
else
|
24
|
-
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
25
|
-
end
|
20
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
21
|
+
spec.metadata['source_code_uri'] = 'https://github.com/Qurasoft/open_weather_client'
|
22
|
+
spec.metadata['changelog_uri'] = 'https://github.com/Qurasoft/open_weather_client/blob/main/CHANGES.md'
|
26
23
|
|
27
24
|
# Specify which files should be added to the gem when it is released.
|
28
25
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
29
26
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
30
27
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
31
28
|
end
|
32
|
-
spec.bindir =
|
33
|
-
spec.executables = spec.files.grep(%r{^
|
34
|
-
spec.require_paths = [
|
29
|
+
spec.bindir = 'bin'
|
30
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ['lib']
|
35
32
|
|
36
|
-
spec.add_dependency
|
33
|
+
spec.add_dependency 'faraday', '>= 2'
|
37
34
|
|
38
|
-
spec.add_development_dependency
|
39
|
-
spec.add_development_dependency
|
40
|
-
spec.add_development_dependency
|
41
|
-
spec.add_development_dependency
|
42
|
-
spec.add_development_dependency
|
35
|
+
spec.add_development_dependency 'bundler', '>= 1.17'
|
36
|
+
spec.add_development_dependency 'rake', '>= 10.0'
|
37
|
+
spec.add_development_dependency 'rspec', '>= 3.0'
|
38
|
+
spec.add_development_dependency 'rubocop'
|
39
|
+
spec.add_development_dependency 'simplecov'
|
40
|
+
spec.add_development_dependency 'webmock'
|
43
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: open_weather_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lucas Keune
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rubocop
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -94,10 +94,27 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: webmock
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description: ''
|
98
112
|
email:
|
99
113
|
- lucas.keune@qurasoft.de
|
100
|
-
executables:
|
114
|
+
executables:
|
115
|
+
- ".gitignore"
|
116
|
+
- console
|
117
|
+
- setup
|
101
118
|
extensions: []
|
102
119
|
extra_rdoc_files: []
|
103
120
|
files:
|
@@ -106,6 +123,7 @@ files:
|
|
106
123
|
- ".github/workflows/ruby.yml"
|
107
124
|
- ".gitignore"
|
108
125
|
- ".rspec"
|
126
|
+
- ".rubocop.yml"
|
109
127
|
- ".travis.yml"
|
110
128
|
- CHANGES.md
|
111
129
|
- Gemfile
|
@@ -116,7 +134,10 @@ files:
|
|
116
134
|
- bin/console
|
117
135
|
- bin/setup
|
118
136
|
- lib/open_weather_client.rb
|
137
|
+
- lib/open_weather_client/caching.rb
|
138
|
+
- lib/open_weather_client/caching/memory.rb
|
119
139
|
- lib/open_weather_client/configuration.rb
|
140
|
+
- lib/open_weather_client/request.rb
|
120
141
|
- lib/open_weather_client/version.rb
|
121
142
|
- lib/open_weather_client/weather.rb
|
122
143
|
- open_weather_client.gemspec
|
@@ -135,12 +156,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
156
|
requirements:
|
136
157
|
- - ">="
|
137
158
|
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
159
|
+
version: '3.0'
|
139
160
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
161
|
requirements:
|
141
162
|
- - ">="
|
142
163
|
- !ruby/object:Gem::Version
|
143
|
-
version: '
|
164
|
+
version: '2'
|
144
165
|
requirements: []
|
145
166
|
rubygems_version: 3.4.1
|
146
167
|
signing_key:
|