activerecord-shipworks 0.1.7 → 0.1.8

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: 6fd1146d5bfaaf2332e1bac2336b6ad66695216ddbc65bc8b5d39f8e3819e462
4
- data.tar.gz: b6a68397182fd2201173938b847fa6431e137d723bca33b60535b3d6c7285021
3
+ metadata.gz: a321ef833e2c013396c31e2828868169fbf46c2a52b0221f9784f06b8abe3c23
4
+ data.tar.gz: 2dd4b771c12188fffd8f9a5f4a85df24d16033069f1bfddfb53639ade9e6c16a
5
5
  SHA512:
6
- metadata.gz: d4af7133f4e4ed0ffec65a2ca7e52bc71d251ef193cb4cad8682f220aaf15bd108e30ab47c96a80cc62e76de5b8d801cccf06187e8f677f1ef048d128b24f022
7
- data.tar.gz: f7414364c1abb88b964491524c6274df8d1b2e96e20ea5283ef9488993293b4f3b5ad6213071b8560ac15cdcb2707f9b4c9a7a71b358d1fc680663f4eea7c2d7
6
+ metadata.gz: da58bfe0801de0a6083020454013304f53be8241329922cfe032567cb0f643ca0795d85d6d95c54bc7256020181635513ce012dbcb4d45ddaf7257bf65d6b082
7
+ data.tar.gz: 6f50663a4b1927938fc314401197a49e581a9f4f42196f89c1debfe79d42c2b577d7a598c45aa476845b569110178fe3868ad45cd893ca5859ce274de60328cf
data/README.md CHANGED
@@ -35,16 +35,16 @@ Shipworks::Order.order(:OrderDate).last(10)
35
35
 
36
36
  ### ER Diagram
37
37
  ```
38
- +---------+
39
- | |
40
- | Store |
41
- | |
42
- +----+----+
43
- |
44
- |
45
- |
46
- /|\
47
- +---------------+ +-----+-----+ +-------------+ +----------------------+
38
+ +---------+ +---------------+ +-------------------+
39
+ | | | | | |
40
+ | Store | | AmazonOrder | | AmazonOrderItem |
41
+ | | | | | |
42
+ +-------+-+ +-+-------------+ +---+---------------+
43
+ | | |
44
+ | | |
45
+ | | |
46
+ /|\ | |
47
+ +---------------+ +--+-----+--+ +---------+---+ +----------------------+
48
48
  | |\ | | /| | /| |
49
49
  | OrderCharge +---------+ Order +-------+ OrderItem +------+ OrderItemAttribute |
50
50
  | |/ | | \| | \| |
@@ -0,0 +1,15 @@
1
+ module Shipworks
2
+ class AmazonOrder < ShipworksRecord
3
+ belongs_to :order, foreign_key: 'OrderID'
4
+
5
+ FULFILLMENT_CHANNEL_MAPPING = {
6
+ 0 => 'Unavailable',
7
+ 1 => 'Amazon',
8
+ 2 => 'Merchant'
9
+ }
10
+
11
+ def FulfillmentChannelName
12
+ FULFILLMENT_CHANNEL_MAPPING[self.FulfillmentChannel] || FulfillmentChannel
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ module Shipworks
2
+ class AmazonOrderItem < ShipworksRecord
3
+ belongs_to :order_item, foreign_key: 'OrderItemID'
4
+ end
5
+ end
@@ -5,5 +5,6 @@ module Shipworks
5
5
  has_many :shipments, foreign_key: 'OrderID'
6
6
  has_many :order_items, foreign_key: 'OrderID'
7
7
  has_many :order_charges, foreign_key: 'OrderID'
8
+ has_one :amazon_order, foreign_key: 'OrderID'
8
9
  end
9
10
  end
@@ -2,5 +2,6 @@ module Shipworks
2
2
  class OrderItem < ShipworksRecord
3
3
  belongs_to :order, foreign_key: 'OrderID'
4
4
  has_many :order_item_attributes, foreign_key: 'OrderItemID'
5
+ has_one :amazon_order_item, foreign_key: 'OrderItemID'
5
6
  end
6
7
  end
@@ -1,5 +1,22 @@
1
1
  module Shipworks
2
2
  class Store < ShipworksRecord
3
3
  has_many :orders, foreign_key: 'StoreID'
4
+
5
+ STORE_TYPE_MAPPING = {
6
+ 1 => 'eBay',
7
+ 10 => 'Amazon',
8
+ 13 => 'Zen Cart',
9
+ 31 => 'Generic - File',
10
+ 34 => 'Newegg',
11
+ 35 => 'Buy.com',
12
+ 36 => 'Sears',
13
+ 61 => 'Choxi',
14
+ 75 => 'Walmart',
15
+ 78 => 'GeekSeller'
16
+ }
17
+
18
+ def TypeName
19
+ STORE_TYPE_MAPPING[self.TypeCode] || self.TypeCode
20
+ end
4
21
  end
5
22
  end
@@ -1,3 +1,3 @@
1
1
  module Shipworks
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.8'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-shipworks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dennis Wu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-30 00:00:00.000000000 Z
11
+ date: 2018-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord-sqlserver-adapter
@@ -34,6 +34,8 @@ files:
34
34
  - MIT-LICENSE
35
35
  - README.md
36
36
  - Rakefile
37
+ - app/models/shipworks/amazon_order.rb
38
+ - app/models/shipworks/amazon_order_item.rb
37
39
  - app/models/shipworks/note.rb
38
40
  - app/models/shipworks/order.rb
39
41
  - app/models/shipworks/order_charge.rb
@@ -69,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
71
  version: '0'
70
72
  requirements: []
71
73
  rubyforge_project:
72
- rubygems_version: 2.7.4
74
+ rubygems_version: 2.7.6
73
75
  signing_key:
74
76
  specification_version: 4
75
77
  summary: ActiveRecord for Shipworks.