mws-merchant_fulfillment 1.0.2 → 1.0.3

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: 21e1f631e9fcf4d24f6552e1a066eb24e4a144d4
4
- data.tar.gz: 23613f881ca575e4a7c0649c168fcee635961670
3
+ metadata.gz: 461cb90e26076c276d38439ade73f08fed606cae
4
+ data.tar.gz: 18309e821be339668837be654a14d82aef60d3ea
5
5
  SHA512:
6
- metadata.gz: b5fc0a1eb3e2bf5fad79869129aea450f74f5badc200d47120cbcc41b8e8c2dd04f8a71990e051a1ae06f5c7380fd07062455593bf28393289d6c4087fa8c232
7
- data.tar.gz: a33adca1d7756b3fa1e1de013d6bea02a2c6bf587ece82a21136891cea0f2f990a41887971e71b76f38d8e1aa310d2b1370b5e8e5fc8bceb26165f4ed9ec84d2
6
+ metadata.gz: 30cfb04adc868b566c799deae42602972500fedb818e2637d5e3504d8219112bdbb2b9e6143952528bade46c50be47221334692cb18e1d43bbf626fcbd33f346
7
+ data.tar.gz: 56504cc5309f27a06290cae93806c055237376b0aaa2b3e99e7af8f4d96f6fbfd0fd9113c0179637420b057fd0f6c08a193275dfd0daed23c6357b5b9b90ed78
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  [![Build Status](https://travis-ci.org/Flowspace-Team/mws-merchant_fulfillment.svg?branch=master)](https://travis-ci.org/Flowspace-Team/mws-merchant_fulfillment)
2
+ [![Gem Version](https://badge.fury.io/rb/mws-merchant_fulfillment.svg)](https://badge.fury.io/rb/mws-merchant_fulfillment)
2
3
 
3
4
  # MWS Merchant Fulfillment
4
5
 
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mws/merchant_fulfillment/entity'
4
+
5
+ module MWS
6
+ module MerchantFulfillment
7
+ class Address < Entity
8
+ attribute(:city) do
9
+ text_at_xpath('City')
10
+ end
11
+
12
+ attribute(:phone) do
13
+ text_at_xpath('Phone')
14
+ end
15
+
16
+ attribute(:country_code) do
17
+ text_at_xpath('CountryCode')
18
+ end
19
+
20
+ attribute(:postal_code) do
21
+ text_at_xpath('PostalCode')
22
+ end
23
+
24
+ attribute(:name) do
25
+ text_at_xpath('Name')
26
+ end
27
+
28
+ attribute(:address_line_1) do
29
+ text_at_xpath('AddressLine1')
30
+ end
31
+
32
+ attribute(:state_or_province_code) do
33
+ text_at_xpath('StateOrProvinceCode')
34
+ end
35
+
36
+ attribute(:email) do
37
+ text_at_xpath('Email')
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mws/merchant_fulfillment/entity'
4
+
5
+ module MWS
6
+ module MerchantFulfillment
7
+ class Dimensions < Entity
8
+ attribute(:width) do
9
+ float_at_xpath('Width')
10
+ end
11
+
12
+ attribute(:length) do
13
+ float_at_xpath('Length')
14
+ end
15
+
16
+ attribute(:unit) do
17
+ text_at_xpath('Unit')
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mws/merchant_fulfillment/entity'
4
+
5
+ module MWS
6
+ module MerchantFulfillment
7
+ class FileContents < Entity
8
+ attribute(:checksum) do
9
+ text_at_xpath('Checksum')
10
+ end
11
+
12
+ attribute(:contents) do
13
+ text_at_xpath('Contents')
14
+ end
15
+
16
+ attribute(:file_type) do
17
+ text_at_xpath('FileType')
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mws/merchant_fulfillment/entity'
4
+
5
+ module MWS
6
+ module MerchantFulfillment
7
+ class Item < Entity
8
+ attribute(:quantity) do
9
+ integer_at_xpath('Quantity')
10
+ end
11
+
12
+ attribute(:order_item_id) do
13
+ text_at_xpath('OrderItemId')
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mws/merchant_fulfillment/entity'
4
+ require 'mws/merchant_fulfillment/file_contents'
5
+ require 'mws/merchant_fulfillment/dimensions'
6
+
7
+ module MWS
8
+ module MerchantFulfillment
9
+ class Label < Entity
10
+ attribute(:file_contents) do
11
+ node = xpath('FileContents').first
12
+ FileContents.new(node)
13
+ end
14
+
15
+ attribute(:label_format) do
16
+ text_at_xpath('LabelFormat')
17
+ end
18
+
19
+ attribute(:dimensions) do
20
+ node = xpath('Dimensions').first
21
+ Dimensions.new(node)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mws/merchant_fulfillment/entity'
4
+
5
+ module MWS
6
+ module MerchantFulfillment
7
+ class PackageDimensions < Entity
8
+ attribute(:width) do
9
+ float_at_xpath('Width')
10
+ end
11
+
12
+ attribute(:length) do
13
+ float_at_xpath('Length')
14
+ end
15
+
16
+ attribute(:height) do
17
+ float_at_xpath('Height')
18
+ end
19
+
20
+ attribute(:unit) do
21
+ text_at_xpath('Unit')
22
+ end
23
+ end
24
+ end
25
+ end
@@ -4,6 +4,7 @@ require 'peddler'
4
4
  require 'nokogiri'
5
5
  require 'mws/merchant_fulfillment/service_status'
6
6
  require 'mws/merchant_fulfillment/shipping_services'
7
+ require 'mws/merchant_fulfillment/shipment'
7
8
 
8
9
  module MWS
9
10
  module MerchantFulfillment
@@ -20,6 +21,9 @@ module MWS
20
21
  case node.name
21
22
  when /GetEligibleShippingServices/
22
23
  ShippingServices.new(node)
24
+ when /CreateShipment/
25
+ shipment_node = node.children.find { |node| node.name == 'Shipment' }
26
+ Shipment.new(shipment_node)
23
27
  else
24
28
  raise NotImplementedError
25
29
  end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mws/merchant_fulfillment/address'
4
+ require 'mws/merchant_fulfillment/entity'
5
+ require 'mws/merchant_fulfillment/item'
6
+ require 'mws/merchant_fulfillment/label'
7
+ require 'mws/merchant_fulfillment/package_dimensions'
8
+ require 'mws/merchant_fulfillment/shipping_service'
9
+ require 'mws/merchant_fulfillment/weight'
10
+
11
+ module MWS
12
+ module MerchantFulfillment
13
+ class Shipment < Entity
14
+ attribute(:insurance) do
15
+ money_at_xpath('Insurance')
16
+ end
17
+
18
+ attribute(:ship_to_address) do
19
+ node = xpath('ShipToAddress').first
20
+ Address.new(node)
21
+ end
22
+
23
+ attribute(:amazon_order_id) do
24
+ text_at_xpath('AmazonOrderId')
25
+ end
26
+
27
+ attribute(:weight) do
28
+ node = xpath('Weight').first
29
+ Weight.new(node)
30
+ end
31
+
32
+ attribute(:label) do
33
+ node = xpath('Label').first
34
+ Label.new(node)
35
+ end
36
+
37
+ attribute(:shipping_service) do
38
+ node = xpath('ShippingService').first
39
+ ShippingService.new(node)
40
+ end
41
+
42
+ attribute(:package_dimensions) do
43
+ node = xpath('PackageDimensions').first
44
+ PackageDimensions.new(node)
45
+ end
46
+
47
+ attribute(:created_date) do
48
+ time_at_xpath('CreatedDate')
49
+ end
50
+
51
+ attribute(:ship_from_address) do
52
+ node = xpath('ShipFromAddress').first
53
+ Address.new(node)
54
+ end
55
+
56
+ attribute(:item_list) do
57
+ xpath('ItemList/Item').map { |node| Item.new(node) }
58
+ end
59
+
60
+ attribute(:status) do
61
+ text_at_xpath('Status')
62
+ end
63
+
64
+ attribute(:tracking_id) do
65
+ text_at_xpath('TrackingId')
66
+ end
67
+
68
+ attribute(:shipment_id) do
69
+ text_at_xpath('ShipmentId')
70
+ end
71
+ end
72
+ end
73
+ end
@@ -1,19 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'mws/merchant_fulfillment/entity'
4
- require 'mws/merchant_fulfillment/shipping_service_option'
4
+ require 'mws/merchant_fulfillment/shipping_service_options'
5
5
  require 'mws/merchant_fulfillment/rate'
6
6
  require 'mws/merchant_fulfillment/available_format_options_for_label'
7
7
 
8
8
  module MWS
9
9
  module MerchantFulfillment
10
10
  class ShippingService < Entity
11
+ attribute(:shipping_service_name) do
12
+ text_at_xpath('ShippingServiceName')
13
+ end
14
+
11
15
  attribute(:carrier_name) do
12
16
  text_at_xpath('CarrierName')
13
17
  end
14
18
 
15
19
  attribute(:shipping_service_options) do
16
- xpath('ShippingServiceOptions').map { |node| ShippingServiceOption.new(node) }
20
+ node = xpath('ShippingServiceOptions').first
21
+ ShippingServiceOptions.new(node)
17
22
  end
18
23
 
19
24
  attribute(:shipping_service_id) do
@@ -46,11 +51,19 @@ module MWS
46
51
  time_at_xpath('ShipDate')
47
52
  end
48
53
 
54
+ attribute(:rate) do
55
+ money_at_xpath('Rate')
56
+ end
57
+
49
58
  attribute(:available_format_options_for_label) do
50
59
  xpath('AvailableFormatOptionsForLabel/LabelFormatOption').map { |node|
51
60
  AvailableFormatOptionsForLabel.new(node)
52
61
  }
53
62
  end
63
+
64
+ attribute(:requires_additional_seller_inputs) do
65
+ boolean_at_path('RequiresAdditionalSellerInputs')
66
+ end
54
67
  end
55
68
  end
56
69
  end
@@ -4,7 +4,7 @@ require 'mws/merchant_fulfillment/entity'
4
4
 
5
5
  module MWS
6
6
  module MerchantFulfillment
7
- class ShippingServiceOption < Entity
7
+ class ShippingServiceOptions < Entity
8
8
  attribute(:carrier_will_pickup) do
9
9
  boolean_at_path('CarrierWillPickUp')
10
10
  end
@@ -12,6 +12,14 @@ module MWS
12
12
  attribute(:delivery_experience) do
13
13
  text_at_xpath('DeliveryExperience')
14
14
  end
15
+
16
+ attribute(:label_format) do
17
+ text_at_xpath('LabelFormat')
18
+ end
19
+
20
+ attribute(:declared_value) do
21
+ money_at_xpath('DeclaredValue')
22
+ end
15
23
  end
16
24
  end
17
25
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module MWS
4
4
  module MerchantFulfillment
5
- VERSION = '1.0.2'
5
+ VERSION = '1.0.3'
6
6
  end
7
7
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mws/merchant_fulfillment/entity'
4
+
5
+ module MWS
6
+ module MerchantFulfillment
7
+ class Weight < Entity
8
+ attribute(:value) do
9
+ float_at_xpath('Value')
10
+ end
11
+
12
+ attribute(:unit) do
13
+ text_at_xpath('Unit')
14
+ end
15
+ end
16
+ end
17
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mws-merchant_fulfillment
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Becker
@@ -196,18 +196,26 @@ files:
196
196
  - bin/console
197
197
  - bin/setup
198
198
  - lib/mws-merchant_fulfillment.rb
199
+ - lib/mws/merchant_fulfillment/address.rb
199
200
  - lib/mws/merchant_fulfillment/available_format_options_for_label.rb
200
201
  - lib/mws/merchant_fulfillment/collection.rb
202
+ - lib/mws/merchant_fulfillment/dimensions.rb
201
203
  - lib/mws/merchant_fulfillment/document.rb
202
204
  - lib/mws/merchant_fulfillment/entity.rb
205
+ - lib/mws/merchant_fulfillment/file_contents.rb
206
+ - lib/mws/merchant_fulfillment/item.rb
207
+ - lib/mws/merchant_fulfillment/label.rb
208
+ - lib/mws/merchant_fulfillment/package_dimensions.rb
203
209
  - lib/mws/merchant_fulfillment/parser.rb
204
210
  - lib/mws/merchant_fulfillment/rate.rb
205
211
  - lib/mws/merchant_fulfillment/service_status.rb
206
212
  - lib/mws/merchant_fulfillment/service_status_message.rb
213
+ - lib/mws/merchant_fulfillment/shipment.rb
207
214
  - lib/mws/merchant_fulfillment/shipping_service.rb
208
- - lib/mws/merchant_fulfillment/shipping_service_option.rb
215
+ - lib/mws/merchant_fulfillment/shipping_service_options.rb
209
216
  - lib/mws/merchant_fulfillment/shipping_services.rb
210
217
  - lib/mws/merchant_fulfillment/version.rb
218
+ - lib/mws/merchant_fulfillment/weight.rb
211
219
  - mws-merchant_fulfillment.gemspec
212
220
  homepage: https://github.com/Flowspace-Team/mws-merchant_fulfillment
213
221
  licenses: