rice-dining 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb60ebd8074ac82c4320cc651b77244b701ffe1f
4
- data.tar.gz: 032954ce38d5f06fb50fd2e51fa60e295d5a046e
3
+ metadata.gz: 5ba72d909940c766ae7986376076eff2a7e86e4a
4
+ data.tar.gz: 4d8a502c61a2d191bdbe46edbdb0ef5c315e2106
5
5
  SHA512:
6
- metadata.gz: 88cc2e2a8f4ff5a2976543fbfa02d8e0070b4678b130c34f2140e2c5e030e54837e053d9fccff20f3a6688cb51559521f9f74dd21cfa557d9e31ed813c6e219f
7
- data.tar.gz: bbb299f046fd5f85007768c53b5e2ab012ca307563ce47c6c3e564f90488348e6d8b554da0824ee3fd7459c7798a6bf7fd84b51782350bff0a295d9a8aa40b9a
6
+ metadata.gz: a36d5b22138fe1ee7bc87b0c08ea6d893cf72e9d4e92a968ed1f295e756815d54926a8118f96a29eeb5fd349dee236a5844ac14316b946723898848a68a92a5d
7
+ data.tar.gz: 97e05d13092ea66bb6f0a942d2d71550cdea48ea37b89bf0273e75c38ca0f5e0e2aebab94a9ae8ecc9ee6d7d36039998c916a4092b87a754bb8f747cad9ec68a
@@ -115,13 +115,13 @@ module Rice
115
115
 
116
116
  # stash allergen references in the "key" section
117
117
  doc.css('div#key div.diet'.freeze).each do |allergen_node|
118
- self.allergen_reference allergen_node['class'.freeze]
118
+ allergen_reference allergen_node['class'.freeze]
119
119
  end
120
120
 
121
121
  # build each location
122
122
  locations = []
123
123
  location_nodes = doc.css('div.item'.freeze)
124
- raise ManifestCreateError, "couldn't find locations".freeze if location_nodes.empty?
124
+ raise CreateError, "couldn't find locations".freeze if location_nodes.empty?
125
125
  location_nodes.each do |location_node|
126
126
  # get the servery name
127
127
  name_nodes = location_node.css('div.servery-title h1'.freeze)
@@ -141,7 +141,7 @@ module Rice
141
141
  item_allergens, item_name = [], item_node.text
142
142
  item_name.strip!
143
143
  item_node.parent.css('div.allergen div.diet'.freeze).each do |allergen_node|
144
- allergen = self.allergen_reference allergen_node['class'.freeze]
144
+ allergen = allergen_reference allergen_node['class'.freeze]
145
145
  item_allergens << allergen if allergen
146
146
  end
147
147
 
@@ -165,10 +165,12 @@ module Rice
165
165
  Rice::Dining::Manifest.new locations, @allergen_map.values
166
166
  else
167
167
  # Problem with the response
168
- raise ManifestCreateError, "got HTTP #{res.code} from #{Rice::Dining::BASE}"
168
+ raise CreateError, "got HTTP #{res.code} from #{Rice::Dining::BASE}"
169
169
  end
170
170
  end
171
171
 
172
+ private
173
+
172
174
  def allergen_reference allergen_class
173
175
  # build the allergen key
174
176
  key = allergen_cleanup allergen_class
@@ -198,6 +200,8 @@ module Rice
198
200
  return nil if ret.nil?
199
201
  ret[:type].downcase.to_sym
200
202
  end
203
+
204
+ CreateError ||= Class.new StandardError
201
205
  end
202
206
 
203
207
  def self.manifest
@@ -1,7 +1,7 @@
1
1
  module Rice
2
2
  module Dining
3
3
  module Version
4
- VERSION = '0.2.1'.freeze
4
+ VERSION = '0.2.2'.freeze
5
5
  SHORT_NAME = Rice::Dining.to_s.freeze
6
6
  SHORT_IDENT = "#{SHORT_NAME} v#{VERSION}".freeze
7
7
  NAME = SHORT_NAME.freeze
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rice-dining
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Morgan Jones