study_the_map 0.1.0 → 0.1.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 +4 -4
- data/README.md +1 -1
- data/lib/study_the_map/ski_map.rb +40 -1
- data/lib/study_the_map/version.rb +1 -1
- data/study_the_map-0.1.0.gem +0 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f6d3dbdcf93b0843ac6fe8bbd2707c0b8a872eb
|
4
|
+
data.tar.gz: f3250d4616f7b588793054321950a7f3832f1760
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 223dc091679cfa39ba3caafb17d292c635d2f3ee00445d2104c7fc6e3a4d3a96a76237f804adf170ffd3ffb9681140a3246de8429fe756d00fe922b3fc48143f
|
7
|
+
data.tar.gz: c9282db77bf3877df9d099b8d354c0e3ad4f0721e65ddfa448fb2d5f296ddb46a9cad4c1c91a204a4ffaf3571c56b4fd0c8974074eb6f702e5338688a3b5f998
|
data/README.md
CHANGED
@@ -20,7 +20,7 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
|
23
|
+
Check that it installed using require 'study_the_map'. Then you can run the app from irb with StudyTheMap::CLI.new.call or ./bin/study_the_map if you've downloaded the repo.
|
24
24
|
|
25
25
|
## Development
|
26
26
|
|
@@ -5,79 +5,118 @@ class SkiMaps
|
|
5
5
|
attr_accessor :area_name, :area_info
|
6
6
|
|
7
7
|
def initialize(area_name)
|
8
|
+
|
8
9
|
@area_name = area_name
|
9
10
|
area_doc = Nokogiri::XML(open("https://skimap.org/SkiAreas/view/#{LookupIDS.find_ski_area_id(area_name)}.xml"))
|
11
|
+
|
10
12
|
@area_info = area_doc
|
11
13
|
map_count = area_doc.search("skiMaps").attr('count').text
|
14
|
+
|
12
15
|
puts "There are #{map_count} maps for this ski area."
|
16
|
+
|
13
17
|
if map_count == "0"
|
18
|
+
|
14
19
|
StudyTheMap::CLI.new.call
|
20
|
+
|
15
21
|
elsif map_count == "1"
|
22
|
+
|
16
23
|
self.pick_map(self.get_map_years.join)
|
24
|
+
|
17
25
|
else
|
26
|
+
|
18
27
|
puts "Please wait while we fetch the maps' years..."
|
19
28
|
puts ""
|
29
|
+
|
20
30
|
self.list_map_years
|
21
31
|
map_years = self.get_map_years
|
32
|
+
|
22
33
|
input = nil
|
34
|
+
|
23
35
|
until map_years.include?(input)
|
24
36
|
puts ""
|
25
37
|
puts "Please pick a year that is listed."
|
26
38
|
input = gets.strip
|
27
39
|
end
|
40
|
+
|
28
41
|
self.pick_map(input)
|
42
|
+
|
29
43
|
end
|
30
44
|
end
|
31
45
|
|
32
46
|
def get_map_ids
|
47
|
+
|
33
48
|
id_array = []
|
49
|
+
|
34
50
|
@area_info.search("skiMaps skiMap").each do |map|
|
35
51
|
id_array << map.attr('id')
|
36
52
|
end
|
53
|
+
|
37
54
|
id_array
|
55
|
+
|
38
56
|
end
|
39
57
|
|
40
58
|
def get_map_data
|
59
|
+
|
41
60
|
map_data_array = []
|
61
|
+
|
42
62
|
self.get_map_ids.each do |id|
|
43
63
|
map_data_array << Nokogiri::XML(open("https://skimap.org/SkiMaps/view/#{id}.xml"))
|
44
64
|
end
|
65
|
+
|
45
66
|
map_data_array
|
67
|
+
|
46
68
|
end
|
47
69
|
|
48
70
|
def list_map_years
|
71
|
+
|
49
72
|
self.get_map_data.each do |map|
|
50
73
|
puts map.search("yearPublished").text
|
51
74
|
end
|
75
|
+
|
52
76
|
end
|
53
77
|
|
54
78
|
def get_map_years
|
79
|
+
|
55
80
|
map_years_array = []
|
81
|
+
|
56
82
|
self.get_map_data.each do |map|
|
57
83
|
map_years_array << map.search("yearPublished").text
|
58
84
|
end
|
85
|
+
|
59
86
|
map_years_array
|
87
|
+
|
60
88
|
end
|
61
89
|
|
62
90
|
def pick_map(year)
|
91
|
+
|
63
92
|
map_data = self.get_map_data.detect do |map|
|
64
93
|
map.search("yearPublished").text == year
|
65
94
|
end
|
95
|
+
|
66
96
|
begin
|
67
97
|
url = map_data.search("render").attr('url').text
|
68
98
|
rescue Exception
|
69
99
|
url = map_data.search("unprocessed").attr('url').text
|
70
100
|
end
|
101
|
+
|
71
102
|
puts "Would you like to download the Map to your working directory or see it in your browser?"
|
72
103
|
puts "Type 'browser', 'download', or 'exit'"
|
104
|
+
|
73
105
|
input = gets.strip
|
106
|
+
|
74
107
|
case input
|
75
|
-
|
108
|
+
|
109
|
+
when "download"
|
110
|
+
|
76
111
|
exec "curl -O #{url}"
|
77
112
|
puts "Enjoy your map!"
|
113
|
+
|
78
114
|
when "browser"
|
115
|
+
|
79
116
|
Launchy.open("#{url}")
|
80
117
|
puts "Enjoy your map!"
|
118
|
+
|
81
119
|
end
|
120
|
+
|
82
121
|
end
|
83
122
|
end
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: study_the_map
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bshap93
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- lib/study_the_map/regions.rb
|
121
121
|
- lib/study_the_map/ski_map.rb
|
122
122
|
- lib/study_the_map/version.rb
|
123
|
+
- study_the_map-0.1.0.gem
|
123
124
|
- study_the_map.gemspec
|
124
125
|
homepage: https://github.com/bshap93/study_the_map
|
125
126
|
licenses:
|