eaternet 0.4.2 → 0.4.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: ed980faad2a78ad6296326f407ecef535d48232b
4
- data.tar.gz: 1a60560689dccb31966b409a293d319074ab641a
3
+ metadata.gz: 9f09792a0e3e7fe94b6c3379288c8e49093792f2
4
+ data.tar.gz: 4aa2df5d05299c963e82f774540cad1f54d5a0c3
5
5
  SHA512:
6
- metadata.gz: ef0b520bc6259dfdcd473998c14d92a8f896ce6eccb8b75ccaed9b35a851829e7af500e937713c3772f405d99d5e426ad043adc4676d74aa0bb10ca1966e6bd6
7
- data.tar.gz: d7ac9a6237cf1ac5f94856359b1c13b8dc35d8dfc7ce0bd0e922a85d1bc9f7b2176175458544604c850f38c4330cf6811d98a27151d8a0a312d73c687f2ad6e0
6
+ metadata.gz: 0c7e7427fc67460dcca75658313f734534574dd77fb40fdadd94e73bf6d0be4425b44daf82233004d217b1cac11e123b2c798c56e1c8b3a1c58f07e3ac60b2e4
7
+ data.tar.gz: 87a118b0c3a3ce819f81b92c94b645ed413a09d89982468248d308e61b6f842d679e961cbf71c2fcdfcf364f3717a81f3fdf76f050b6091d398d5c112ef36090
@@ -1,5 +1,6 @@
1
1
  require 'date'
2
2
  require 'eaternet/loggable'
3
+ require 'eaternet/util'
3
4
 
4
5
  module Eaternet
5
6
  module Agencies
@@ -42,9 +43,9 @@ module Eaternet
42
43
  def business(proto)
43
44
  Business.new do |b|
44
45
  b.business_id = proto.orig_key
45
- b.name = proto.name
46
- b.address = proto.address
47
- b.city = proto.city
46
+ b.name = Eaternet::Util.cleanup_title(proto.name)
47
+ b.address = Eaternet::Util.cleanup_title(proto.address)
48
+ b.city = Eaternet::Util.cleanup_title(proto.city)
48
49
  b.postal_code = proto.zipcode
49
50
  b.state = 'NV'
50
51
  end
data/lib/eaternet/util.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'base64'
2
2
  require 'zip'
3
3
  require 'httparty'
4
+ require 'active_support/core_ext/string/inflections'
4
5
 
5
6
  module Eaternet
6
7
  module Util
@@ -66,7 +67,7 @@ module Eaternet
66
67
  # @return [String] the cleaned up string
67
68
  def self.cleanup_title(a_string)
68
69
  return nil if a_string.nil?
69
- cleanup(a_string).titleize
70
+ cleanup(a_string).titleize.sub("Mc Donald's", "McDonald's")
70
71
  end
71
72
 
72
73
  # Remove extraneous whitespace from the string
@@ -1,3 +1,3 @@
1
1
  module Eaternet
2
- VERSION = '0.4.2'
2
+ VERSION = '0.4.3'
3
3
  end
@@ -6,6 +6,10 @@ class Enumerator
6
6
  reject(&:nil?)
7
7
  end
8
8
 
9
+ # Thanks to u/0x0dea for the lazy implementation.
10
+ #
11
+ # @author u/0x0dea
12
+ # @see http://www.reddit.com/r/ruby/comments/37jpnz/is_this_the_best_laziest_way_to_add_compact_and/crnckrv Discussion thread
9
13
  # @return [Enumerator] only my unique elements
10
14
  def uniq
11
15
  cache = Set.new
@@ -18,7 +18,7 @@ class SnhdLivesTest < Minitest::Test
18
18
  VCR.use_cassette(SNHD_CASSETTE) do
19
19
  b = @@snhd.businesses.first
20
20
  assert_equal 'PR0000002', b.business_id
21
- assert_equal "McDonald's #3549 D HOTEL", b.name
21
+ assert_equal "McDonald's #3549 D Hotel", b.name
22
22
  assert_equal '301 Fremont St', b.address
23
23
  assert_equal 'Las Vegas', b.city
24
24
  assert_equal '89101-5600', b.postal_code
@@ -44,4 +44,10 @@ class UtilTest < Minitest::Test
44
44
  Timecop.freeze(Time.now + thirteen_hours) { download_and_cache }
45
45
  assert_requested :get, @url, times: 2
46
46
  end
47
+
48
+ def test_properly_cleans_up_mcdonalds
49
+ input = "McDonald's #3549 D HOTEL"
50
+ desired_output = "McDonald's #3549 D Hotel"
51
+ assert_equal desired_output, Eaternet::Util.cleanup_title(input)
52
+ end
47
53
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eaternet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robb Shecter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-29 00:00:00.000000000 Z
11
+ date: 2015-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler