solidus_shipstation 1.0.0 → 1.1.0

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
  SHA256:
3
- metadata.gz: 37cf9d9129cf565114ca4f4b83ffeea474d5d448e16400a93bc566b92f1344a2
4
- data.tar.gz: 236d9df971bd47bac9c0bab46673f3c0e48dddf14f7110835609788554b42861
3
+ metadata.gz: a9158fe6f42218427d250e4a5283b0760d0dc486fa3f128861b03ace6f2fd5a5
4
+ data.tar.gz: 05f08c3a8854d31590ffd945c0096534ce689c94b544015733b46624b4c87d74
5
5
  SHA512:
6
- metadata.gz: 8ca2d78aaaec9acbf0c28a38a85c73176613c131cae3888d5d63c285f0c94b04116a3a4a728e7639bf8e1b36540b8a87e8260dbd3ee33d081d355e308a3e27fe
7
- data.tar.gz: c14094a306bf705b4289a7455a0818a34fe5b926e25fcb20a65f750891c3e554c5cfc468775cb6deaae2a550b68525a7ab533b1bae1164dd27c5fffa9ead0a11
6
+ metadata.gz: ddda2973c4dc3f11b7dc242f0fa5dcc4818dcdee6d9ec78c062e2a8a2295e0212e2bfb24de4199e6d6eef44401838041320ce81b71029c0ad177b652d0d63fba
7
+ data.tar.gz: a1ede00a82aedc12f3242857f1c159b8c2e935ad869131890d384b4e817ea2630e1b134792d26fb44a94b3d4d8e62cadc4258d6cbaebd6abf0096784a808395d
data/.rubocop.yml CHANGED
@@ -5,6 +5,7 @@ require:
5
5
 
6
6
  AllCops:
7
7
  NewCops: disable
8
+ TargetRubyVersion: 2.5
8
9
 
9
10
  Layout/LineLength:
10
11
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,15 +1,22 @@
1
1
  # Changelog
2
2
 
3
- ## [v1.0.0](https://github.com/solidusio-contrib/solidus_shipstation/tree/v1.0.0) (2021-05-26)
3
+ ## [v1.1.0](https://github.com/solidusio-contrib/solidus_shipstation/tree/v1.1.0) (2021-10-26)
4
4
 
5
- [Full Changelog](https://github.com/solidusio-contrib/solidus_shipstation/compare/v2.0.1...v1.0.0)
5
+ [Full Changelog](https://github.com/solidusio-contrib/solidus_shipstation/compare/v1.0.0...v1.1.0)
6
6
 
7
- **Closed issues:**
7
+ **Implemented enhancements:**
8
8
 
9
- - Prepare Solidus Shipstation for Solidus 3.0 [\#6](https://github.com/solidusio-contrib/solidus_shipstation/issues/6)
9
+ - Add support to ruby 3 [\#21](https://github.com/solidusio-contrib/solidus_shipstation/pull/21) ([stefano-sarioli](https://github.com/stefano-sarioli))
10
+
11
+ **Fixed bugs:**
12
+
13
+ - Handle orders without a billing address [\#20](https://github.com/solidusio-contrib/solidus_shipstation/pull/20) ([aldesantis](https://github.com/aldesantis))
10
14
 
11
15
  **Merged pull requests:**
12
16
 
17
+ - Fix Ruby version requirement [\#22](https://github.com/solidusio-contrib/solidus_shipstation/pull/22) ([stefano-sarioli](https://github.com/stefano-sarioli))
18
+ - Allow ShipmentNotice class to be customized [\#17](https://github.com/solidusio-contrib/solidus_shipstation/pull/17) ([cesartalves](https://github.com/cesartalves))
19
+ - Address: infer residential attribute from company [\#16](https://github.com/solidusio-contrib/solidus_shipstation/pull/16) ([nerfologist](https://github.com/nerfologist))
13
20
  - Fix pending API sync query returning synced shipments [\#15](https://github.com/solidusio-contrib/solidus_shipstation/pull/15) ([aldesantis](https://github.com/aldesantis))
14
21
  - Swallow errors in `Api::SyncShipmentsJob` [\#14](https://github.com/solidusio-contrib/solidus_shipstation/pull/14) ([aldesantis](https://github.com/aldesantis))
15
22
  - API sync improvements [\#13](https://github.com/solidusio-contrib/solidus_shipstation/pull/13) ([aldesantis](https://github.com/aldesantis))
@@ -23,13 +30,13 @@
23
30
  - Fix installer [\#2](https://github.com/solidusio-contrib/solidus_shipstation/pull/2) ([kennyadsl](https://github.com/kennyadsl))
24
31
  - Make extension compatible with latest Solidus [\#1](https://github.com/solidusio-contrib/solidus_shipstation/pull/1) ([aldesantis](https://github.com/aldesantis))
25
32
 
26
- ## [v2.0.1](https://github.com/solidusio-contrib/solidus_shipstation/tree/v2.0.1) (2014-05-01)
33
+ ## [v1.0.0](https://github.com/solidusio-contrib/solidus_shipstation/tree/v1.0.0) (2021-05-26)
27
34
 
28
- [Full Changelog](https://github.com/solidusio-contrib/solidus_shipstation/compare/v1.3.2...v2.0.1)
35
+ [Full Changelog](https://github.com/solidusio-contrib/solidus_shipstation/compare/077ee0bcdf9faf66121faa4387ec645122892c98...v1.0.0)
29
36
 
30
- ## [v1.3.2](https://github.com/solidusio-contrib/solidus_shipstation/tree/v1.3.2) (2013-11-22)
37
+ **Closed issues:**
31
38
 
32
- [Full Changelog](https://github.com/solidusio-contrib/solidus_shipstation/compare/077ee0bcdf9faf66121faa4387ec645122892c98...v1.3.2)
39
+ - Prepare Solidus Shipstation for Solidus 3.0 [\#6](https://github.com/solidusio-contrib/solidus_shipstation/issues/6)
33
40
 
34
41
 
35
42
 
@@ -21,7 +21,8 @@ module Spree
21
21
  end
22
22
 
23
23
  def shipnotify
24
- SolidusShipstation::ShipmentNotice.from_payload(params.to_unsafe_h).apply
24
+ shipment_notice_class = SolidusShipstation.configuration.shipment_notice_class.constantize
25
+ shipment_notice_class.from_payload(params.to_unsafe_h).apply
25
26
  head :ok
26
27
  rescue SolidusShipstation::Error => e
27
28
  head :bad_request
@@ -21,6 +21,11 @@ SolidusShipstation.configure do |config|
21
21
  # Set this to `true` if you want canceled shipments included in the endpoint.
22
22
  # config.export_canceled_shipments = false
23
23
 
24
+ # You can customize the class used to receive notifications from the POST request
25
+ # Make sure it has a class method `from_payload` which receives the notification hash
26
+ # and an instance method `apply`
27
+ # config.shipment_notice_class = 'SolidusShipstation::ShipmentNotice'
28
+
24
29
  ####### API integration
25
30
  # Only uncomment these lines if you're going to use the API integration.
26
31
 
@@ -40,6 +40,8 @@ module SolidusShipstation
40
40
  raise e
41
41
  end
42
42
 
43
+ return unless response
44
+
43
45
  response['results'].each do |shipstation_order|
44
46
  shipment = shipment_matcher.call(shipstation_order, shipments)
45
47
 
@@ -51,15 +51,16 @@ module SolidusShipstation
51
51
 
52
52
  def serialize_address(address)
53
53
  {
54
- name: SolidusSupport.combined_first_and_last_name_in_address? ? address.name : address.full_name,
55
- company: address.company,
56
- street1: address.address1,
57
- street2: address.address2,
58
- city: address.city,
59
- state: address.state&.abbr,
60
- postalCode: address.zipcode,
61
- country: address.country&.iso,
62
- phone: address.phone,
54
+ name: (SolidusSupport.combined_first_and_last_name_in_address? ? address&.name : address&.full_name).to_s,
55
+ company: address&.company.to_s,
56
+ street1: address&.address1.to_s,
57
+ street2: address&.address2.to_s,
58
+ city: address&.city.to_s,
59
+ state: address&.state&.abbr.to_s,
60
+ postalCode: address&.zipcode.to_s,
61
+ country: address&.country&.iso.to_s,
62
+ phone: address&.phone.to_s,
63
+ residential: address&.company.blank?
63
64
  }
64
65
  end
65
66
 
@@ -16,6 +16,7 @@ module SolidusShipstation
16
16
  :api_secret,
17
17
  :api_shipment_matcher,
18
18
  :error_handler,
19
+ :shipment_notice_class
19
20
  )
20
21
 
21
22
  def initialize
@@ -27,6 +28,8 @@ module SolidusShipstation
27
28
  @api_shipment_matcher = proc do |shipstation_order, shipments|
28
29
  shipments.find { |shipment| shipment.number == shipstation_order['orderNumber'] }
29
30
  end
31
+
32
+ @shipment_notice_class = 'SolidusShipstation::ShipmentNotice'
30
33
  end
31
34
  end
32
35
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusShipstation
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
@@ -8,8 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ['Stephen Puiszis']
9
9
  spec.email = 'steve@tablexi.com'
10
10
 
11
- spec.summary = 'Solidus/ShipStation Integration'
12
- spec.description = 'Integrates ShipStation API with Solidus. Supports exporting shipments and importing tracking numbers'
11
+ spec.summary = 'A Solidus extension for integrating the ShipStation API.'
13
12
  spec.homepage = 'https://github.com/solidusio-contrib/solidus_shipstation'
14
13
  spec.license = 'BSD-3-Clause'
15
14
 
@@ -17,7 +16,7 @@ Gem::Specification.new do |spec|
17
16
  spec.metadata['source_code_uri'] = 'https://github.com/solidusio-contrib/solidus_shipstation'
18
17
  spec.metadata['changelog_uri'] = 'https://github.com/solidusio-contrib/solidus_shipstation/blob/master/CHANGELOG.md'
19
18
 
20
- spec.required_ruby_version = Gem::Requirement.new('~> 2.5')
19
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.5')
21
20
 
22
21
  # Specify which files should be added to the gem when it is released.
23
22
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -95,7 +95,7 @@ RSpec.describe SolidusShipstation::Api::Client do
95
95
  private
96
96
 
97
97
  def build_client(options = {})
98
- described_class.new({
98
+ described_class.new(**{
99
99
  request_runner: instance_spy('SolidusShipstation::Api::RequestRunner'),
100
100
  error_handler: instance_spy('Proc'),
101
101
  shipment_serializer: stub_shipment_serializer,
@@ -8,5 +8,18 @@ RSpec.describe SolidusShipstation::Api::ShipmentSerializer do
8
8
 
9
9
  expect(result).to be_instance_of(Hash)
10
10
  end
11
+
12
+ it 'sets residential = false in address if company is given' do
13
+ order = create(:order_ready_to_ship,
14
+ bill_address: build(:address, company: 'ACME Co.'),
15
+ ship_address: build(:address, company: nil))
16
+ shipment = order.shipments.first
17
+
18
+ serializer = described_class.new(store_id: '12345678')
19
+ result = serializer.call(shipment)
20
+
21
+ expect(result[:billTo][:residential]).to be false
22
+ expect(result[:shipTo][:residential]).to be true
23
+ end
11
24
  end
12
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_shipstation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Puiszis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-26 00:00:00.000000000 Z
11
+ date: 2021-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -114,8 +114,7 @@ dependencies:
114
114
  - - ">="
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
- description: Integrates ShipStation API with Solidus. Supports exporting shipments
118
- and importing tracking numbers
117
+ description:
119
118
  email: steve@tablexi.com
120
119
  executables: []
121
120
  extensions: []
@@ -210,7 +209,7 @@ require_paths:
210
209
  - lib
211
210
  required_ruby_version: !ruby/object:Gem::Requirement
212
211
  requirements:
213
- - - "~>"
212
+ - - ">="
214
213
  - !ruby/object:Gem::Version
215
214
  version: '2.5'
216
215
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -219,10 +218,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
218
  - !ruby/object:Gem::Version
220
219
  version: '0'
221
220
  requirements: []
222
- rubygems_version: 3.1.4
221
+ rubygems_version: 3.2.22
223
222
  signing_key:
224
223
  specification_version: 4
225
- summary: Solidus/ShipStation Integration
224
+ summary: A Solidus extension for integrating the ShipStation API.
226
225
  test_files:
227
226
  - spec/controllers/spree/shipstation_controller_spec.rb
228
227
  - spec/fixtures/shipstation_xml_schema.xsd