snowreports 0.3.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +1 -1
- data/lib/snowreports/endpoint.rb +23 -23
- data/lib/snowreports/fetcher.rb +4 -3
- data/lib/snowreports/version.rb +1 -1
- data/lib/snowreports.rb +2 -2
- data/snowreports.gemspec +4 -4
- metadata +15 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d38a4371bf59ac3bf908a3f2c47b15046052ed0302018f48993489e3daf4b107
|
4
|
+
data.tar.gz: 6c3b5c50ad4a538a588051b258225d7a23040dc3d4fb84d9b0e0e12a204ef434
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cfe2f27ad3036f41c4b2f107e3698a5a6e3d8f3b2ceb54c1c00ec3c4959ece7d679fb48518b3c004ed1d1a09a8d920d8c91519ce0b0b459af81e3d7b8638983
|
7
|
+
data.tar.gz: 12be010d5243912bffde9ff432ff06a2584a7bf6d3c30e5a391239dbfee53fdab8c6b08066a55552f2398c2e2a93e7fa2290d1223796deff6d17c96bf792bb1c
|
data/README.md
CHANGED
@@ -26,6 +26,6 @@ Snowreports.fetch(:turoa)
|
|
26
26
|
|
27
27
|
```
|
28
28
|
|
29
|
-
See [endpoints class](https://github.com/snowpool/snowreports/blob/
|
29
|
+
See [endpoints class](https://github.com/snowpool/snowreports/blob/master/lib/snowreports/endpoint.rb) for the various field names you can pass in.
|
30
30
|
|
31
31
|
PR's welcome.
|
data/lib/snowreports/endpoint.rb
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
module Snowreports
|
2
2
|
class Endpoint
|
3
|
-
SnowpoolWrapper = Struct.new(:id, :
|
3
|
+
SnowpoolWrapper = Struct.new(:id, :snowhq_id)
|
4
4
|
|
5
5
|
def self.all
|
6
6
|
@all ||= {
|
7
|
-
turoa: SnowpoolWrapper.new(22,
|
8
|
-
whakapapa: SnowpoolWrapper.new(21,
|
9
|
-
cardrona: SnowpoolWrapper.new(15,
|
10
|
-
treble_cone: SnowpoolWrapper.new(7,
|
11
|
-
remarkables: SnowpoolWrapper.new(6,
|
12
|
-
coronet_peak: SnowpoolWrapper.new(14,
|
13
|
-
snow_farm: SnowpoolWrapper.new(18,
|
14
|
-
manganui: SnowpoolWrapper.new(24,
|
15
|
-
rainbow: SnowpoolWrapper.new(20,
|
16
|
-
mt_hutt: SnowpoolWrapper.new(8,
|
17
|
-
mt_cheeseman: SnowpoolWrapper.new(3,
|
18
|
-
hanmer_springs: SnowpoolWrapper.new(9,
|
19
|
-
broken_river: SnowpoolWrapper.new(4,
|
20
|
-
my_lyford: SnowpoolWrapper.new(16,
|
21
|
-
craigieburn: SnowpoolWrapper.new(10,
|
22
|
-
porters: SnowpoolWrapper.new(1,
|
23
|
-
mt_olympus: SnowpoolWrapper.new(5,
|
24
|
-
temple_basin: SnowpoolWrapper.new(2,
|
25
|
-
ohau: SnowpoolWrapper.new(12,
|
26
|
-
mt_dobson: SnowpoolWrapper.new(13,
|
27
|
-
roundhill: SnowpoolWrapper.new(17,
|
28
|
-
fox_peak: SnowpoolWrapper.new(11,
|
7
|
+
turoa: SnowpoolWrapper.new(22, 9),
|
8
|
+
whakapapa: SnowpoolWrapper.new(21, 10),
|
9
|
+
cardrona: SnowpoolWrapper.new(15, 2),
|
10
|
+
treble_cone: SnowpoolWrapper.new(7, 4),
|
11
|
+
remarkables: SnowpoolWrapper.new(6, 6),
|
12
|
+
coronet_peak: SnowpoolWrapper.new(14,5),
|
13
|
+
snow_farm: SnowpoolWrapper.new(18, 24),
|
14
|
+
manganui: SnowpoolWrapper.new(24, 14),
|
15
|
+
rainbow: SnowpoolWrapper.new(20, 12),
|
16
|
+
mt_hutt: SnowpoolWrapper.new(8, 7),
|
17
|
+
mt_cheeseman: SnowpoolWrapper.new(3, 16),
|
18
|
+
hanmer_springs: SnowpoolWrapper.new(9, 20),
|
19
|
+
broken_river: SnowpoolWrapper.new(4, 13),
|
20
|
+
my_lyford: SnowpoolWrapper.new(16, 15),
|
21
|
+
craigieburn: SnowpoolWrapper.new(10, 17),
|
22
|
+
porters: SnowpoolWrapper.new(1, 3),
|
23
|
+
mt_olympus: SnowpoolWrapper.new(5, 19),
|
24
|
+
temple_basin: SnowpoolWrapper.new(2, 18),
|
25
|
+
ohau: SnowpoolWrapper.new(12, 11),
|
26
|
+
mt_dobson: SnowpoolWrapper.new(13, 8),
|
27
|
+
roundhill: SnowpoolWrapper.new(17, 23),
|
28
|
+
fox_peak: SnowpoolWrapper.new(11, 22),
|
29
29
|
}
|
30
30
|
end
|
31
31
|
end
|
data/lib/snowreports/fetcher.rb
CHANGED
@@ -8,8 +8,9 @@ module Snowreports
|
|
8
8
|
attr_accessor :user, :pass
|
9
9
|
end
|
10
10
|
|
11
|
-
def self.fetch(
|
12
|
-
|
11
|
+
def self.fetch(snowhq_id:)
|
12
|
+
snowhq_path = "/feeds/xml?reportid=#{snowhq_id}"
|
13
|
+
conn.get(snowhq_path)
|
13
14
|
end
|
14
15
|
|
15
16
|
def self.conn
|
@@ -20,7 +21,7 @@ module Snowreports
|
|
20
21
|
|
21
22
|
raise "You must supply a username and password for API access" unless snow_user && snow_pass
|
22
23
|
|
23
|
-
conn.
|
24
|
+
conn.request :authorization, :basic, snow_user, snow_pass
|
24
25
|
conn
|
25
26
|
end
|
26
27
|
end
|
data/lib/snowreports/version.rb
CHANGED
data/lib/snowreports.rb
CHANGED
@@ -6,13 +6,13 @@ require_relative "snowreports/fetcher"
|
|
6
6
|
module Snowreports
|
7
7
|
def self.fetch(ski_field)
|
8
8
|
endpoint = Endpoint.all.fetch(ski_field)
|
9
|
-
response = Fetcher.fetch(
|
9
|
+
response = Fetcher.fetch(snowhq_id: endpoint.snowhq_id)
|
10
10
|
Builder.build(xml: response.body, field_id: endpoint.id)
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.all
|
14
14
|
Endpoint.all.each_with_object([]) do |(_field_name, endpoint), acc|
|
15
|
-
response = Fetcher.fetch(
|
15
|
+
response = Fetcher.fetch(snowhq_id: endpoint.snowhq_id)
|
16
16
|
acc << Builder.build(xml: response.body, field_id: endpoint.id)
|
17
17
|
acc
|
18
18
|
end
|
data/snowreports.gemspec
CHANGED
@@ -21,12 +21,12 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.add_runtime_dependency "faraday", "~> 0
|
24
|
+
spec.add_runtime_dependency "faraday", "~> 2.0"
|
25
25
|
spec.add_runtime_dependency "nokogiri", "~> 1.8"
|
26
26
|
|
27
27
|
|
28
|
-
spec.add_development_dependency "bundler", "~>
|
29
|
-
spec.add_development_dependency "rake"
|
28
|
+
spec.add_development_dependency "bundler", "~> 2"
|
29
|
+
spec.add_development_dependency "rake"
|
30
30
|
spec.add_development_dependency "rspec", "~> 3.0"
|
31
|
-
spec.add_development_dependency "pry"
|
31
|
+
spec.add_development_dependency "pry"
|
32
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snowreports
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Davey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: nokogiri
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: pry
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0
|
89
|
+
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0
|
96
|
+
version: '0'
|
97
97
|
description: Fetches are parses reports from snowreports.co.nz
|
98
98
|
email:
|
99
99
|
- patrick.davey@gmail.com
|
@@ -136,8 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
|
-
|
140
|
-
rubygems_version: 2.6.12
|
139
|
+
rubygems_version: 3.2.22
|
141
140
|
signing_key:
|
142
141
|
specification_version: 4
|
143
142
|
summary: Fetches and parses reports from snowreports.co.nz
|