study_the_map 0.1.1 → 0.1.3

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
2
  SHA1:
3
- metadata.gz: 4f6d3dbdcf93b0843ac6fe8bbd2707c0b8a872eb
4
- data.tar.gz: f3250d4616f7b588793054321950a7f3832f1760
3
+ metadata.gz: 938fe24962c2504ddaed0154595be22c9b62f0fa
4
+ data.tar.gz: 93cb17b26a8f6d87c4f7adb18fb0f0f35c057dde
5
5
  SHA512:
6
- metadata.gz: 223dc091679cfa39ba3caafb17d292c635d2f3ee00445d2104c7fc6e3a4d3a96a76237f804adf170ffd3ffb9681140a3246de8429fe756d00fe922b3fc48143f
7
- data.tar.gz: c9282db77bf3877df9d099b8d354c0e3ad4f0721e65ddfa448fb2d5f296ddb46a9cad4c1c91a204a4ffaf3571c56b4fd0c8974074eb6f702e5338688a3b5f998
6
+ metadata.gz: 3eefaab7b942e239dcee0d0d70ea7506dbac2e82dea5543b9968c4a2d309e81299cde9d8d03e4ffb782d94a748e5f8ee0c937f69950f9376c6dcbff1539ce125
7
+ data.tar.gz: 9fc8e80e499432ed0ca174dc1e324567fc3e86b655dc7be418b42013c841e905e0082a6f510703a8cbef7aaf339477ca5ab0a158bc4a05b193b785debdf52366
@@ -3,27 +3,37 @@ require "./lib/study_the_map.rb"
3
3
  class StudyTheMap::CLI
4
4
 
5
5
  def call
6
+
6
7
  get_areas
8
+
7
9
  goodbye
10
+
8
11
  end
9
12
 
10
13
  def get_map
14
+
11
15
  resort_name = nil
12
16
  while resort_name != 'back'
17
+
13
18
  puts "1. Please enter the name of the ski area you would like the map for:"
14
19
  puts '-----------------------------------------------------------------------'
15
20
  puts "2. Or type 'back' to go back to the main menu."
16
21
  puts '-->'
17
22
 
18
23
  resort_name = gets.strip
24
+
19
25
  if resort_name == 'back'
26
+
20
27
  get_areas
28
+
21
29
  elsif Region.ski_area_list.include?(resort_name)
30
+
22
31
  SkiMaps.new(resort_name)
32
+
23
33
  else
34
+
24
35
  puts "Invalid ski area name"
25
36
  end
26
-
27
37
  end
28
38
  end
29
39
 
@@ -31,6 +41,7 @@ class StudyTheMap::CLI
31
41
 
32
42
  input = nil
33
43
  while input != 'exit'
44
+
34
45
  puts "1. Select a region (type 'region') or Ski Resort (type 'resort') to study associated ski trail maps!"
35
46
  puts '-----------------------------------------------------------------------'
36
47
  puts "2. Or check out the world map to find resorts and trails: (type 'world')"
@@ -39,24 +50,33 @@ class StudyTheMap::CLI
39
50
  puts '-->'
40
51
 
41
52
  input = gets.strip.downcase
53
+
42
54
  case input
43
55
  when "region"
56
+
44
57
  region
58
+
45
59
  when "world"
60
+
46
61
  Launchy.open("http://openskimap.org/")
62
+
47
63
  when "resort"
64
+
48
65
  get_map
66
+
49
67
  else
68
+
50
69
  puts "Please enter 'region', 'resort', or 'world'"
51
70
  puts '-----------------------------------------------------------------------'
52
71
  end
53
72
  end
54
-
55
73
  end
56
74
 
57
75
  def region
76
+
58
77
  region = nil
59
78
  while region != "back"
79
+
60
80
  puts "-----------------------------------------------------------------------"
61
81
  puts "1. Input a region for a list of ski resorts, or"
62
82
  puts '-----------------------------------------------------------------------'
@@ -68,28 +88,34 @@ class StudyTheMap::CLI
68
88
  region = gets.strip
69
89
 
70
90
  if region.size == 1
91
+
71
92
  Region.starts_with(region)
72
93
  region
94
+
73
95
  else
74
96
 
75
97
  begin
98
+
76
99
  region_object = Region.new(region)
77
100
  region_object.full_list
101
+
78
102
  rescue Exception
103
+
79
104
  if region != "back"
80
105
  puts '-----------------------------------------------------------------------'
81
106
  puts "Not a valid region."
82
107
  puts '-----------------------------------------------------------------------'
83
108
  end
109
+
84
110
  region
85
- end
86
-
87
- end
88
111
 
112
+ end
113
+ end
89
114
  end
90
115
  end
91
116
 
92
117
  def goodbye
118
+
93
119
  puts "Come back anytime for more maps!"
94
120
  end
95
121
  end
@@ -10,7 +10,14 @@ class SkiMaps
10
10
  area_doc = Nokogiri::XML(open("https://skimap.org/SkiAreas/view/#{LookupIDS.find_ski_area_id(area_name)}.xml"))
11
11
 
12
12
  @area_info = area_doc
13
- map_count = area_doc.search("skiMaps").attr('count').text
13
+
14
+ map_count_and_pick
15
+
16
+ end
17
+
18
+ def map_count_and_pick
19
+
20
+ map_count = @area_info.search("skiMaps").attr('count').text
14
21
 
15
22
  puts "There are #{map_count} maps for this ski area."
16
23
 
@@ -38,9 +45,10 @@ class SkiMaps
38
45
  input = gets.strip
39
46
  end
40
47
 
41
- self.pick_map(input)
48
+ pick_map(input)
42
49
 
43
50
  end
51
+
44
52
  end
45
53
 
46
54
  def get_map_ids
@@ -105,7 +113,7 @@ class SkiMaps
105
113
  input = gets.strip
106
114
 
107
115
  case input
108
-
116
+
109
117
  when "download"
110
118
 
111
119
  exec "curl -O #{url}"
@@ -1,3 +1,3 @@
1
1
  module StudyTheMap
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: study_the_map
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - bshap93
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-08 00:00:00.000000000 Z
11
+ date: 2016-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -120,7 +120,6 @@ 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
124
123
  - study_the_map.gemspec
125
124
  homepage: https://github.com/bshap93/study_the_map
126
125
  licenses:
Binary file