tomorrowio_rb 0.0.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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/tomorrowio_rb.rb +45 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fb80619cdd8fb1802e47a1b94fc525c579b051a595ede4b7e33b5e297a4c6205
4
+ data.tar.gz: 12395f9419111238bc4c1f796e43aa1482b7c54660aacc6db38d3dcbb127ecf5
5
+ SHA512:
6
+ metadata.gz: 3e926fa92dd16811df3303042b8428de341430a20848e7f0cccb70f981e339151181c51655474113e059bec32e69c82688f6fc7283bb3ed269cfbf8853425bde
7
+ data.tar.gz: e8a3e47cc2107af05eb088f07e8b78cf9ed928f8f81314cd5427a58ae98c5a98317aa64f4774656293f1cfe2dd10537cd9741a176d4faac0a891580210ca8b26
@@ -0,0 +1,45 @@
1
+ require_relative 'configuration.rb'
2
+ require 'faraday'
3
+ require 'json'
4
+
5
+ module Tomorrowiorb
6
+ extend Configuration
7
+
8
+ class << self
9
+ def forecast(location, timesteps=nil, units=nil)
10
+ connection = Faraday.new(
11
+ url: "#{Tomorrowiorb.api_endpoint}/weather/forecast",
12
+ params: {
13
+ 'location': location,
14
+ 'apikey': Tomorrowiorb.api_key
15
+ },
16
+ headers: {'Content-Type' => 'application/json'}
17
+ )
18
+ req.params['timesteps'] = timesteps if timesteps
19
+ req.params['units'] = units if units
20
+ response = connection.get('')
21
+
22
+ return TomorrowioResponse.new(response.status,response.headers, response.body)
23
+ end
24
+ end
25
+
26
+ class TomorrowioResponse
27
+ def initialize(status, headers, body)
28
+ @status = status
29
+ @headers = headers
30
+ @body = body
31
+ end
32
+
33
+ def status
34
+ @status
35
+ end
36
+
37
+ def headers
38
+ @headers
39
+ end
40
+
41
+ def body
42
+ @body
43
+ end
44
+ end
45
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tomorrowio_rb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Cedric Wille
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-10-21 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Ruby wrapper for the Tomorrow.io weather API, currently only the forecast
14
+ endpoint.
15
+ email: 24487628+cwille97@users.noreply.github.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/tomorrowio_rb.rb
21
+ homepage: https://github.com/cwille97/tomorrowio_rb
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubygems_version: 3.4.10
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Ruby wrapper for the Tomorrow.io weather API
44
+ test_files: []