shopifydev 0.0.27 → 0.0.28

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: 0156fc58c825c5ad40d5e5415f476d42edb78823
4
- data.tar.gz: 0f5a76c5a691df4c022c2ca81c2e788aaf5edd7b
3
+ metadata.gz: 47004a0eb9003e44d868576c6602018869e8ada3
4
+ data.tar.gz: 46577e6156117dd03dee5cdcb92729d6d36dc490
5
5
  SHA512:
6
- metadata.gz: f2db15ea8cce3c0bb050a958e575cb963e5d713dd1ebeb707e6166b08794375aaefcadd68fea9d9db57f4819aa7a374f91690cf41cc71c2ebaa9767ed9167ca1
7
- data.tar.gz: d28ba6091764b37f390d8cbe048ae8415b59e005da91b635df187d610d748f85fc032a32e005ec63412fae85101a332070da4a2ab78df6092c9ac1dcb6db07c0
6
+ metadata.gz: 5c665d7b4af97eab1fbc270c037b9aca02ededd5ce5dd49761f24ea41f09dcf84b7e8d27cb9a804d7b5b279e4e773c3b6465ebc396471b79ff03c30869f168eb
7
+ data.tar.gz: 5276cb4b3ad6fa423b27c7a484d033f9148d299a8dc49f11bfe2bafdadf5a1919621418c13d7c015010909d7c47548a4682e4180ce8a59209cd87a54234c7680
@@ -4268,13 +4268,22 @@ module ValidZip
4268
4268
  "99901", "99903", "99918", "99919", "99921", "99922", "99923", "99925", "99926", "99927",
4269
4269
  "99928", "99929", "99950"]
4270
4270
 
4271
- def self.valid_zip
4272
- ValidZip::Zips.sample
4273
- end
4274
- def self.valid_place
4275
- zip = valid_zip
4276
- Oj.load(
4277
- `curl http://zip.elevenbasetwo.com/v2/US/#{zip}`
4278
- ).with_indifferent_access.merge(zip: zip)
4279
- end
4271
+ def self.valid_zip
4272
+ ValidZip::Zips.sample
4273
+ end
4274
+
4275
+ def self.valid_place(opts=nil)
4276
+ place = nil
4277
+ tries = 0
4278
+ loop do
4279
+ tries += 1
4280
+ return nil if tries > 100
4281
+ zip = valid_zip
4282
+ place = Oj.load(
4283
+ `curl http://zip.elevenbasetwo.com/v2/US/#{zip}`
4284
+ ).with_indifferent_access.merge(zip: zip)
4285
+ break if opts.nil? || opts.all?{|k,v| place[k].nil? || (place[k].downcase == v.downcase)}
4286
+ end
4287
+ return place
4288
+ end
4280
4289
  end
@@ -1,5 +1,7 @@
1
1
  require_relative 'test/current_shop'
2
2
  require_relative 'test/order_fixture'
3
+ require_relative 'test/valid_zip'
4
+ require_relative 'test/valid_postal_code'
3
5
  module Shopifydev
4
6
  module Test
5
7
  class << self
@@ -1,3 +1,3 @@
1
1
  module Shopifydev
2
- VERSION = "0.0.27"
2
+ VERSION = "0.0.28"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopifydev
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.27
4
+ version: 0.0.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Johnston