aftership 4.4.0 → 4.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +48 -37
- data/lib/aftership.rb +2 -1
- data/lib/aftership/v4/base.rb +8 -3
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e290f58d38534b293261b1dcc9bdde6c4db06663c73eebc277db93939533f173
|
4
|
+
data.tar.gz: 4a848b707e8a6dd8c56130f8937a93e70f9d04b094911b844e1167bcd92d3266
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27e51d324f901739b724e28a3e51416c51c8a46404b56d43cfae82a421fb6f99fcb15e263f5340efdd265c0bc9a178b0b90f0b286d85351ed4ba0d1755b4c9ce
|
7
|
+
data.tar.gz: 9302f3835df2bf1dbf80b4ab7bad7b598fe7aff0a8cc1afb2fa6106f60c04ee437e32f06224cc705ecbc38df14196f55b6728cb51dd60569eed36dce402267b9
|
data/README.md
CHANGED
@@ -8,7 +8,22 @@ This extension helps developers to integrate with AfterShip easily.
|
|
8
8
|
|
9
9
|
AfterShip provides an automated way for online merchants to track packages and send their customers delivery status notifications. Customers no longer need to deal with tracking numbers and track packages on their own. With AfterShip, online merchants extend their customer service after the point of purchase by keeping their customers actively informed, while saving time and money by reducing customers’ questions about the status of their purchase delivery.
|
10
10
|
|
11
|
+
## Migration to 4.5.0+
|
12
|
+
|
13
|
+
We suggest all users to upgrade your `aftership` gem to v4.5.0 as any earlier versions are NOT maintained, which also means you will need to upgrade your ruby version to at least 2.3.0 to be able to use `faraday` the new http client of the revamped `aftership` gem.
|
14
|
+
|
11
15
|
### Changes
|
16
|
+
* 2021-02-08 4.5.0
|
17
|
+
- Downgraded `faraday` to `1.0.1` that accepts ruby 2.3.0+ as required version.
|
18
|
+
- Updated request User agent to follow AfterShip SDK guideline.
|
19
|
+
- Required ruby version is now 2.3.0+
|
20
|
+
|
21
|
+
* 2021-02-08 4.4.0
|
22
|
+
- Removed `httpclient` and used `faraday` 1.3 as http client
|
23
|
+
- Polished project with prettified formatting
|
24
|
+
- Resolved [#31](https://github.com/AfterShip/aftership-sdk-ruby/issues/31): Deprecation of encryption algorithms below 256 bits
|
25
|
+
- Required ruby version updated to 2.4.0+
|
26
|
+
|
12
27
|
* 2016-01-11 4.3.1
|
13
28
|
- Updated gem `httpclient` version to 2.7.1
|
14
29
|
|
@@ -39,69 +54,64 @@ AfterShip provides an automated way for online merchants to track packages and s
|
|
39
54
|
|
40
55
|
1. Add the following line to your application's Gemfile
|
41
56
|
|
42
|
-
|
43
|
-
|
44
|
-
|
57
|
+
```ruby
|
58
|
+
gem "aftership", "~> 4.5"
|
59
|
+
```
|
45
60
|
|
46
61
|
2. Run bundler
|
47
62
|
|
48
|
-
|
49
|
-
|
50
|
-
|
63
|
+
```shell
|
64
|
+
bundle install
|
65
|
+
```
|
51
66
|
|
52
67
|
## Configuration
|
53
68
|
|
54
69
|
1. Before you begin
|
55
70
|
|
56
|
-
|
57
|
-
|
58
|
-
http://www.aftership.com
|
71
|
+
You'll need to have a AfterShip account: http://www.aftership.com
|
59
72
|
|
60
73
|
|
61
74
|
2. Setup the API Key
|
62
75
|
|
63
|
-
|
64
|
-
|
65
|
-
https://www.aftership.com/apps/api
|
76
|
+
You can retrieve your api key at: https://admin.aftership.com/settings/api-keys
|
66
77
|
|
67
78
|
## Usage
|
68
79
|
|
69
80
|
1. Setup
|
70
|
-
|
81
|
+
|
82
|
+
Before using API, please include the gem in your script.
|
71
83
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
84
|
+
```ruby
|
85
|
+
require 'rubygems'
|
86
|
+
require 'aftership'
|
87
|
+
```
|
76
88
|
|
77
|
-
|
89
|
+
You should set you API key before making any request to AfterShip.
|
78
90
|
|
79
|
-
|
80
|
-
|
81
|
-
|
91
|
+
```ruby
|
92
|
+
AfterShip.api_key = 'YOUR_API_KEY' # Replace "YOUR_API_KEY" to your AfterShip api key.
|
93
|
+
```
|
82
94
|
|
83
95
|
|
84
96
|
2. Coding
|
85
97
|
|
98
|
+
```ruby
|
99
|
+
require('aftership')
|
100
|
+
AfterShip.api_key = 'YOUR_API_KEY'
|
86
101
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
AfterShip.api_key = 'YOUR_API_KEY'
|
91
|
-
|
92
|
-
AfterShip::V4::Courier.get
|
93
|
-
AfterShip::V4::Courier.get_all
|
94
|
-
AfterShip::V4::Courier.detect({:tracking_number => 'EJ276142450JP'})
|
102
|
+
AfterShip::V4::Courier.get
|
103
|
+
AfterShip::V4::Courier.get_all
|
104
|
+
AfterShip::V4::Courier.detect({:tracking_number => 'EJ276142450JP'})
|
95
105
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
106
|
+
AfterShip::V4::Tracking.create('1ZA6F598D992381375', {:emails => ['a@abcd.com', 'asdfasdfs@gmail.com']})
|
107
|
+
AfterShip::V4::Tracking.get('ups', '1ZA6F598D992381375')
|
108
|
+
AfterShip::V4::Tracking.get_all
|
109
|
+
AfterShip::V4::Tracking.update('ups', '1ZA6F598D992381375', {:title => 'Testing'})
|
110
|
+
AfterShip::V4::Tracking.retrack('ups', '1ZA6F598D992381375')
|
111
|
+
AfterShip::V4::Tracking.delete('ups', '1ZA6F598D992381375')
|
102
112
|
|
103
|
-
|
104
|
-
|
113
|
+
AfterShip::V4::LastCheckpoint.get('ups', '1ZA6F598D992381375')
|
114
|
+
```
|
105
115
|
|
106
116
|
## The License (MIT)
|
107
117
|
|
@@ -110,5 +120,6 @@ Released under the MIT license. See the LICENSE file for the complete wording.
|
|
110
120
|
|
111
121
|
## Contributor
|
112
122
|
|
123
|
+
- Ryan Zou [twitter:renyuanz](https://twitter.com/ry_zou)
|
113
124
|
- Alex Topalov <me@alextopalov.com>
|
114
125
|
|
data/lib/aftership.rb
CHANGED
@@ -5,9 +5,10 @@ require 'aftership/v4/tracking'
|
|
5
5
|
require 'aftership/v4/last_checkpoint'
|
6
6
|
|
7
7
|
module AfterShip
|
8
|
-
class << self
|
8
|
+
class << self
|
9
9
|
attr_accessor :api_key
|
10
10
|
end
|
11
11
|
|
12
12
|
URL = ENV['AFTERSHIP_API_ENDPOINT'] || 'https://api.aftership.com'
|
13
|
+
VERSION = '4.5.0'
|
13
14
|
end
|
data/lib/aftership/v4/base.rb
CHANGED
@@ -27,18 +27,23 @@ module AfterShip
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def call
|
30
|
-
headers = {
|
30
|
+
headers = {
|
31
|
+
'aftership-api-key' => AfterShip.api_key,
|
32
|
+
content_type: 'application/json',
|
33
|
+
user_agent: "aftership-sdk-ruby #{AfterShip::VERSION} (#{RUBY_VERSION})"
|
34
|
+
}
|
31
35
|
|
32
36
|
cf_ray = ''
|
33
37
|
output = nil
|
34
38
|
uri = @client.build_url(end_point, query)
|
35
39
|
|
36
40
|
loop do
|
37
|
-
response = @client.run_request(http_verb_method, uri, body, headers)
|
41
|
+
response = @client.run_request(http_verb_method, uri, body.to_json, headers)
|
38
42
|
|
39
|
-
cf_ray = response.headers['
|
43
|
+
cf_ray = response.headers['cf-ray'] if response.headers
|
40
44
|
|
41
45
|
if response.body
|
46
|
+
# This try catch is actually useless (will improve in next major version.)
|
42
47
|
begin
|
43
48
|
output = response.body
|
44
49
|
@trial = MAX_TRIAL + 1
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aftership
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AfterShip Limited
|
@@ -14,28 +14,28 @@ dependencies:
|
|
14
14
|
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.0.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.0.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faraday_middleware
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -91,7 +91,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
91
|
requirements:
|
92
92
|
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version: 2.
|
94
|
+
version: 2.3.0
|
95
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
97
|
- - ">="
|