shiprocket_api 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/shiprocket_api.rb +1 -0
- data/lib/shiprocket_api/resources/base.rb +8 -0
- data/lib/shiprocket_api/resources/custom_order.rb +15 -15
- data/lib/shiprocket_api/resources/pickup_location.rb +6 -7
- data/lib/shiprocket_api/resources/tracking.rb +16 -0
- data/lib/shiprocket_api/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30bfb2da1528a9aa32926bf70d3994bf1dcaca94e10d80456e70cee9877f6693
|
4
|
+
data.tar.gz: 641b677f8661394d9d23c883485edce06314e3ab918f104a75d52c66a8ce5885
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a5aaeb431053c527f944491046c7e3d0aaa00792d7805707c3fa1018c3cd7edc5ed918badea5e39133aadd87a20eeb871a42ac94289ad60d381cfa38c7c3b3e
|
7
|
+
data.tar.gz: 84317f05d64897c3964ad59373fc769958456422b8deb53510e640c5eea6e58b5732ca5ba4f330b50ac39820f33cf4642ff70ccf9ed4acd9f9074bfbb565b2c4
|
data/lib/shiprocket_api.rb
CHANGED
@@ -20,6 +20,14 @@ module ShiprocketAPI
|
|
20
20
|
self.session = nil
|
21
21
|
self.connection.bearer_token = nil
|
22
22
|
end
|
23
|
+
|
24
|
+
def set_resource(resource)
|
25
|
+
ori_prefix = self.prefix
|
26
|
+
self.prefix = self.prefix.split("/")[0..-2].append(resource).join("/")
|
27
|
+
result = yield
|
28
|
+
self.prefix = ori_prefix
|
29
|
+
result
|
30
|
+
end
|
23
31
|
end
|
24
32
|
|
25
33
|
def initialize(attributes = {}, persisted = false)
|
@@ -6,23 +6,23 @@ module ShiprocketAPI
|
|
6
6
|
has_many :order_items, class_name: "ShiprocketAPI::OrderItem"
|
7
7
|
|
8
8
|
DEFAULT_ATTRS = {
|
9
|
-
order_id: "
|
9
|
+
order_id: "",
|
10
10
|
order_date: Date.today.strftime("%Y-%m-%d"),
|
11
|
-
pickup_location: "
|
11
|
+
pickup_location: "",
|
12
12
|
channel_id: "",
|
13
13
|
comment: "",
|
14
14
|
reseller_name: "",
|
15
15
|
company_name: "",
|
16
|
-
billing_customer_name: "
|
16
|
+
billing_customer_name: "",
|
17
17
|
billing_last_name: "",
|
18
|
-
billing_address: "
|
18
|
+
billing_address: "",
|
19
19
|
billing_address_2: "",
|
20
|
-
billing_city: "
|
21
|
-
billing_pincode: "
|
22
|
-
billing_state: "
|
23
|
-
billing_country: "
|
24
|
-
billing_email: "
|
25
|
-
billing_phone:
|
20
|
+
billing_city: "",
|
21
|
+
billing_pincode: "",
|
22
|
+
billing_state: "",
|
23
|
+
billing_country: "",
|
24
|
+
billing_email: "",
|
25
|
+
billing_phone: "",
|
26
26
|
billing_alternate_phone: "",
|
27
27
|
shipping_is_billing: true,
|
28
28
|
shipping_customer_name: "",
|
@@ -41,11 +41,11 @@ module ShiprocketAPI
|
|
41
41
|
giftwrap_charges: "",
|
42
42
|
transaction_charges: "",
|
43
43
|
total_discount: "",
|
44
|
-
sub_total:
|
45
|
-
length:
|
46
|
-
breadth:
|
47
|
-
height:
|
48
|
-
weight:
|
44
|
+
sub_total: "",
|
45
|
+
length: "",
|
46
|
+
breadth: "",
|
47
|
+
height: "",
|
48
|
+
weight: "",
|
49
49
|
ewaybill_no: "",
|
50
50
|
customer_gstin: ""
|
51
51
|
}
|
@@ -24,16 +24,15 @@ module ShiprocketAPI
|
|
24
24
|
}
|
25
25
|
|
26
26
|
class << self
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
result
|
27
|
+
|
28
|
+
def set_prefix_to_list_all_locations
|
29
|
+
set_resource('pickup') do
|
30
|
+
yield
|
31
|
+
end
|
33
32
|
end
|
34
33
|
|
35
34
|
def find_every(options)
|
36
|
-
|
35
|
+
set_prefix_to_list_all_locations do
|
37
36
|
prefix_options, query_options = split_options(options[:params])
|
38
37
|
path = collection_path(prefix_options, query_options)
|
39
38
|
instantiate_collection((format.decode(connection.get(path, headers).body) || []), query_options, prefix_options)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shiprocket_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Chong
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- lib/shiprocket_api/resources/order_item.rb
|
140
140
|
- lib/shiprocket_api/resources/pickup_location.rb
|
141
141
|
- lib/shiprocket_api/resources/session.rb
|
142
|
+
- lib/shiprocket_api/resources/tracking.rb
|
142
143
|
- lib/shiprocket_api/version.rb
|
143
144
|
- shiprocket_api.gemspec
|
144
145
|
homepage: https://github.com/PostCo/sendle_api
|