effective_addresses 1.9.3 → 1.9.4

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
  SHA256:
3
- metadata.gz: e41141e340c412a2e083dfb79792a86f102484fe61734eebf85963ba17c287c8
4
- data.tar.gz: f0f60629f50f7f20e3e8ba6976e6ba9554b18ed6bb38870a4653ab1ad33b9c17
3
+ metadata.gz: 903de54494687e66176870441f7dbf08122086a9d1de3dae3a38da0cbd2cca99
4
+ data.tar.gz: 8535f034cd7392a7f9ee711386248618f2b8d647784e30dfc4fc726220ec55c5
5
5
  SHA512:
6
- metadata.gz: 934bf8000a28eb370e5f444d6f70610ea7b63f5c0d71c0e1da9f1ed0d83265b697b424489b732d2469e3a23edde57c603d11b2daf2aec9a4688635239e45ee4d
7
- data.tar.gz: 170e98c482c1d99e3907864773762f487f0b61b0e5fc8399ffcac6c11f4d03655b547450d0c7a8ae856b97a7b13469bbe83f7a602ad8304b9ae32397f9f82179
6
+ metadata.gz: 0601a1e879b7cdce8604dd836bd4d80bbca09c1606ff68523ef591b07925ad9b5aba9c679a060a82b7cc5b3e16fa8f2bd0a9a4301ca4e1ab399d9c610ee81b94
7
+ data.tar.gz: 0fc12952f62102c4f792a4c25f380daec74a862a5a6a1fab39edd1a2546d11aa44442ea41c60318b64d3773e4a1adb965e767f5b18ed6c50c079f0b8e29f0b45
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2018 Code and Effect Inc.
1
+ Copyright 2021 Code and Effect Inc.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -1,6 +1,4 @@
1
1
  module EffectiveAddressesHelper
2
- @@use_geocoder = defined?(Geocoder)
3
-
4
2
  def effective_address_fields(form, method = 'billing', options = {})
5
3
  method = (method.to_s.include?('_address') ? method.to_s : "#{method}_address")
6
4
 
@@ -28,7 +26,7 @@ module EffectiveAddressesHelper
28
26
  if EffectiveAddresses.pre_selected_country.present?
29
27
  address.country = EffectiveAddresses.pre_selected_country
30
28
  address.state = EffectiveAddresses.pre_selected_state if EffectiveAddresses.pre_selected_state.present?
31
- elsif @@use_geocoder && request.location.present?
29
+ elsif defined?(Geocoder) && request.location.present?
32
30
  location = request.location
33
31
  address.country = location.country_code
34
32
  address.state = location.state_code
@@ -8,27 +8,25 @@ module Effective
8
8
 
9
9
  belongs_to :addressable, polymorphic: true, touch: true
10
10
 
11
- if defined?(EffectiveResources)
12
- effective_resource do
13
- category :string
11
+ effective_resource do
12
+ category :string
14
13
 
15
- full_name :string
16
- address1 :string
17
- address2 :string
14
+ full_name :string
15
+ address1 :string
16
+ address2 :string
18
17
 
19
- if EffectiveAddresses.use_address3
20
- address3 :string
21
- end
18
+ if EffectiveAddresses.use_address3
19
+ address3 :string
20
+ end
22
21
 
23
- city :string
24
- state_code :string
25
- country_code :string
26
- postal_code :string
22
+ city :string
23
+ state_code :string
24
+ country_code :string
25
+ postal_code :string
27
26
 
28
- shipping_address_same_as_billing permitted: true
27
+ shipping_address_same_as_billing permitted: true
29
28
 
30
- timestamps
31
- end
29
+ timestamps
32
30
  end
33
31
 
34
32
  validates :category, :address1, :city, :country_code, :postal_code, presence: true, if: Proc.new { |address| address.present? }
@@ -1,26 +1,31 @@
1
1
  require 'carmen'
2
+ require 'effective_resources'
2
3
  require 'effective_addresses/engine'
3
4
  require 'effective_addresses/version'
4
5
 
5
6
  module EffectiveAddresses
6
7
 
7
- # The following are all valid config keys
8
- mattr_accessor :country_codes
9
- mattr_accessor :country_codes_priority
10
- mattr_accessor :addresses_table_name
11
- mattr_accessor :use_full_name
12
- mattr_accessor :use_address3
13
- mattr_accessor :simple_form_options
14
- mattr_accessor :validate_postal_code_format
15
- mattr_accessor :pre_selected_country
16
- mattr_accessor :pre_selected_state
17
-
18
- def self.setup
19
- yield self
8
+ def self.config_keys
9
+ [
10
+ :addresses_table_name,
11
+ :country_codes,
12
+ :country_codes_priority,
13
+ :use_full_name,
14
+ :use_address3,
15
+ :simple_form_options,
16
+ :validate_postal_code_format,
17
+ :pre_selected_country,
18
+ :pre_selected_state
19
+ ]
20
20
  end
21
21
 
22
+ include EffectiveGem
23
+
22
24
  def self.permitted_params
23
- [:address1, :address2, :address3, :city, :country_code, :state_code, :postal_code, :full_name, :shipping_address_same_as_billing]
25
+ [
26
+ :address1, :address2, :address3, :city, :country_code, :state_code, :postal_code,
27
+ :full_name, :shipping_address_same_as_billing
28
+ ]
24
29
  end
25
30
 
26
31
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveAddresses
2
- VERSION = '1.9.3'.freeze
2
+ VERSION = '1.9.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_addresses
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.3
4
+ version: 1.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-03 00:00:00.000000000 Z
11
+ date: 2021-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: effective_resources
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: carmen
29
43
  requirement: !ruby/object:Gem::Requirement