smartystreets_api 0.2.0 → 0.3.0

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: b973ffd95180ed1525bf06779e749cb979bb10b4
4
- data.tar.gz: 9bbcb1c2d13deb48c17335494114bc203b58f48d
3
+ metadata.gz: ed9642364a02745c73dc239d9a7245604c09aea7
4
+ data.tar.gz: d1ebcb4144482b870552070edc62f050110824e5
5
5
  SHA512:
6
- metadata.gz: d84d3339812023dad016acac091b8929f034e312b9a4381a7a0734ab9dce0fa6299994fe1026a9dcca2d7bbd8a406c8fabd460e8c8b51792444d2d5334319ba4
7
- data.tar.gz: a7acbbc26742bb3be1843ca8e8748abcf68f7d7d32f54d48863abca1e938f77e0b011f7620e7fb4faac965ef8f9221d86821d5d9442dac7538a97c3ce4930d27
6
+ metadata.gz: f69f91fde30409e819aad046be51ddc0a979a26e3d7d7e14706958aab19d925a942d54e0aa4f378d2b79b75df464dbb89cebd95642e2b805e85ff337f6d9156d
7
+ data.tar.gz: b1986b22485138581d582a2ef4b9c4295061fb1371d45eb94d160c78a2fa36542a64dbb4bcfec54515f1f6d7968f2862bebda42f5ebb99a488e71459bb088f6e
@@ -2,7 +2,7 @@ class SmartyStreetsApi::Decorators::BaseDecorator
2
2
  def call(address_object)
3
3
  return if !address_object || !address_object[:components]
4
4
 
5
- self.class.private_instance_methods(false).inject({}) do |decorated_address, attribute|
5
+ decorated_components = self.class.private_instance_methods(false).inject({}) do |decorated_address, attribute|
6
6
  components = self.send(attribute.to_sym)
7
7
 
8
8
  array_values = components.map do |component_name|
@@ -17,5 +17,9 @@ class SmartyStreetsApi::Decorators::BaseDecorator
17
17
 
18
18
  decorated_address
19
19
  end
20
+
21
+ remove_empty_address_lines!(decorated_components)
22
+
23
+ decorated_components
20
24
  end
21
25
  end
@@ -4,6 +4,10 @@ class SmartyStreetsApi::Decorators::InternationalFormat < SmartyStreetsApi::Deco
4
4
 
5
5
  decorated_address[:organization] = address_object[:lines][:organization]
6
6
 
7
+ decorated_address
8
+ end
9
+
10
+ def remove_empty_address_lines!(decorated_address)
7
11
  unless decorated_address[:address2]
8
12
  decorated_address[:address2] = decorated_address[:address3]
9
13
  decorated_address[:address3] = nil
@@ -14,8 +18,6 @@ class SmartyStreetsApi::Decorators::InternationalFormat < SmartyStreetsApi::Deco
14
18
  decorated_address[:address2] = decorated_address[:address3]
15
19
  decorated_address[:address3] = nil
16
20
  end
17
-
18
- decorated_address
19
21
  end
20
22
 
21
23
  private
@@ -4,6 +4,10 @@ class SmartyStreetsApi::Decorators::InternationalFormat2Lines < SmartyStreetsApi
4
4
 
5
5
  decorated_address[:organization] = address_object[:lines][:organization]
6
6
 
7
+ decorated_address
8
+ end
9
+
10
+ def remove_empty_address_lines!(decorated_address)
7
11
  unless decorated_address[:address1]
8
12
  decorated_address[:address1] = decorated_address[:address_1_alternative]
9
13
  decorated_address[:address2] = decorated_address[:address_2_alternative]
@@ -12,7 +16,10 @@ class SmartyStreetsApi::Decorators::InternationalFormat2Lines < SmartyStreetsApi
12
16
  decorated_address.delete(:address_1_alternative)
13
17
  decorated_address.delete(:address_2_alternative)
14
18
 
15
- decorated_address
19
+ unless decorated_address[:address1]
20
+ decorated_address[:address1] = decorated_address[:address2]
21
+ decorated_address[:address2] = nil
22
+ end
16
23
  end
17
24
 
18
25
  private
@@ -1,4 +1,11 @@
1
1
  class SmartyStreetsApi::Decorators::UsFormat < SmartyStreetsApi::Decorators::BaseDecorator
2
+ def remove_empty_address_lines!(decorated_address)
3
+ unless decorated_address[:street]
4
+ decorated_address[:street] = decorated_address[:secondary]
5
+ decorated_address[:secondary] = nil
6
+ end
7
+ end
8
+
2
9
  private
3
10
 
4
11
  def street
@@ -1,3 +1,3 @@
1
1
  module SmartyStreetsApi
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smartystreets_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - florrain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-04 00:00:00.000000000 Z
11
+ date: 2018-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  version: '0'
130
130
  requirements: []
131
131
  rubyforge_project:
132
- rubygems_version: 2.4.8
132
+ rubygems_version: 2.6.11
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: Ruby API client for SmartyStreets