xdelivery 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/xdelivery/api/sales.rb +53 -0
- data/lib/xdelivery/client.rb +6 -0
- data/lib/xdelivery/version.rb +1 -1
- data/lib/xdelivery.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33bf42ea5206fa01969a3f4516e9142b49276a22
|
4
|
+
data.tar.gz: d4144d88efcc751abe6e8a05bd68b348626e405c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5a7cbf5397e0e596188566ad705a35d0d09bd71c41371e24f97b8c5a492aeed6acfd1d9c09550c3c58191d41fce57ddf3c6d8a1637394958ead69430ed676b8
|
7
|
+
data.tar.gz: 900f0f75ee0dc18b1a515af5ec870d38d27cd6e3a979e4f0f5ba9a17bdc5b70d1b70356b008427abd729c6e82d26ffbc79fbf092d0097c6a2e426472e2febc23
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,53 @@
|
|
1
|
+
module Xdelivery
|
2
|
+
module API
|
3
|
+
class Sales < Base
|
4
|
+
include Enumerable
|
5
|
+
|
6
|
+
attr_accessor :sales
|
7
|
+
|
8
|
+
COLUMNS = [
|
9
|
+
:order_id, :recipient, :mobile, :email, :address,
|
10
|
+
:items, :warehouse_items, :total_order_amount, :cash_on_delivery, :order_created_at,
|
11
|
+
:note, :callback_url, :ref_id, :tag
|
12
|
+
]
|
13
|
+
|
14
|
+
INVOICE_COLUMNS = [
|
15
|
+
:create_type, :email, :company_code, :donate_code, :device_id, :device, :items
|
16
|
+
]
|
17
|
+
|
18
|
+
def add(params, invoice_params={})
|
19
|
+
self.sales ||= []
|
20
|
+
(params || {}).delete_if do |k, v|
|
21
|
+
COLUMNS.include?(k) == false
|
22
|
+
end
|
23
|
+
invoice_params.delete_if do |k, v|
|
24
|
+
INVOICE_COLUMNS.include?(k) == false
|
25
|
+
end
|
26
|
+
|
27
|
+
params.merge!(invoice: invoice_params) unless invoice_params.empty?
|
28
|
+
|
29
|
+
sales.push(params)
|
30
|
+
params
|
31
|
+
end
|
32
|
+
|
33
|
+
def [](index)
|
34
|
+
sales[index]
|
35
|
+
end
|
36
|
+
|
37
|
+
def count
|
38
|
+
sales.count
|
39
|
+
end
|
40
|
+
|
41
|
+
def create!
|
42
|
+
response = post('/sales/batch.json')
|
43
|
+
Response::Orders.new(response)
|
44
|
+
end
|
45
|
+
|
46
|
+
protected
|
47
|
+
|
48
|
+
def post_data
|
49
|
+
{ import: { orders: sales } }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/xdelivery/client.rb
CHANGED
data/lib/xdelivery/version.rb
CHANGED
data/lib/xdelivery.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xdelivery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- eddie
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- lib/xdelivery/api/response/orders.rb
|
106
106
|
- lib/xdelivery/api/response/ping.rb
|
107
107
|
- lib/xdelivery/api/response/products.rb
|
108
|
+
- lib/xdelivery/api/sales.rb
|
108
109
|
- lib/xdelivery/client.rb
|
109
110
|
- lib/xdelivery/version.rb
|
110
111
|
- xdelivery-ruby.gemspec
|