xpanse_2go 0.1.0 → 0.1.2

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: a2bb3ad624fd1ac78537bd27941ffbc833f548c6cc866886bbe0af779557bbb1
4
- data.tar.gz: b6fad2e2148e7e4f6b841ccc25ded1fc6396d9c8564e291c61ad0716b71a688d
3
+ metadata.gz: 9680387a41f27d192eea6f37a7f9495cd6de9385a126cb72f0b47f5ec3075512
4
+ data.tar.gz: 9930b491654c0499ddceb9f9cd8b6d03c02bc84f329d2278e96c1962e86647b5
5
5
  SHA512:
6
- metadata.gz: 837a6c97a2d16104c3dd81a8d5abda98d25bad4d942e4a08669c6cae2d49ab566ce8b0610d5619792dcb5f716d8ec20cac20b101f03f49a70708a3c95950c692
7
- data.tar.gz: 0cf3e33b930a1b30298e0e3205c84eb79704de055b6d9ffa6f9bf0e9455fce4a0fa6a709365ac20ce4f20f081e1ea716e7898a4e51e21c37e18c0bc20283721e
6
+ metadata.gz: 521ad42898b33ab747c2b2f073aae7e0fd9d3132646ca61fafb26c03c6defd8853b5cf7763c09ee6b8cbb1921683266efbad1c3d3fb1a9cdc636ade2f1eb5d7b
7
+ data.tar.gz: e28d10494172d051a1e38553e52f41c4f989068fc1b8b853cea68f00768c0a6400f5fe180baa3491a82b2d680da88704ad687c54e6a3f72260aa7bd8063aa50c
data/.DS_Store CHANGED
Binary file
data/.gitignore CHANGED
File without changes
data/.rspec CHANGED
File without changes
data/.rubocop.yml CHANGED
File without changes
data/.travis.yml CHANGED
File without changes
data/.vscode/launch.json CHANGED
File without changes
@@ -2,6 +2,5 @@
2
2
  "editor.fontFamily": "'Roboto Mono for Powerline', Menlo, Monaco, 'Courier New', monospace",
3
3
  "editor.fontLigatures": true,
4
4
  "workbench.fontAliasing": "auto",
5
- "editor.fontSize": 9,
6
5
  "editor.tabSize": 2
7
6
  }
data/Gemfile CHANGED
File without changes
data/Gemfile.lock CHANGED
@@ -1,78 +1,74 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- xpanse_2go (0.1.0)
5
- activemodel (~> 5.1)
4
+ xpanse_2go (0.1.2)
5
+ activemodel (~> 6.0)
6
6
  fast_jsonapi (~> 1.3)
7
7
  typhoeus (~> 1.3)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activemodel (5.2.2)
13
- activesupport (= 5.2.2)
14
- activesupport (5.2.2)
12
+ activemodel (6.0.0)
13
+ activesupport (= 6.0.0)
14
+ activesupport (6.0.0)
15
15
  concurrent-ruby (~> 1.0, >= 1.0.2)
16
16
  i18n (>= 0.7, < 2)
17
17
  minitest (~> 5.1)
18
18
  tzinfo (~> 1.1)
19
+ zeitwerk (~> 2.1, >= 2.1.8)
19
20
  ast (2.4.0)
20
- concurrent-ruby (1.1.4)
21
+ concurrent-ruby (1.1.5)
21
22
  diff-lcs (1.3)
22
- dotenv (2.7.1)
23
+ dotenv (2.7.5)
23
24
  ethon (0.12.0)
24
25
  ffi (>= 1.3.0)
25
26
  factory_bot (4.11.1)
26
27
  activesupport (>= 3.0.0)
27
- faker (1.9.3)
28
+ faker (1.9.6)
28
29
  i18n (>= 0.7)
29
30
  fast_jsonapi (1.5)
30
31
  activesupport (>= 4.2)
31
- ffi (1.10.0)
32
- i18n (1.5.3)
32
+ ffi (1.11.1)
33
+ i18n (1.7.0)
33
34
  concurrent-ruby (~> 1.0)
34
- jaro_winkler (1.5.2)
35
- minitest (5.11.3)
36
- parallel (1.14.0)
37
- parser (2.6.0.0)
35
+ jaro_winkler (1.5.3)
36
+ minitest (5.12.2)
37
+ parallel (1.18.0)
38
+ parser (2.6.5.0)
38
39
  ast (~> 2.4.0)
39
- powerpack (0.1.2)
40
- psych (3.1.0)
41
40
  rainbow (3.0.0)
42
41
  rake (10.5.0)
43
- rspec (3.8.0)
44
- rspec-core (~> 3.8.0)
45
- rspec-expectations (~> 3.8.0)
46
- rspec-mocks (~> 3.8.0)
47
- rspec-core (3.8.0)
48
- rspec-support (~> 3.8.0)
49
- rspec-expectations (3.8.2)
42
+ rspec (3.9.0)
43
+ rspec-core (~> 3.9.0)
44
+ rspec-expectations (~> 3.9.0)
45
+ rspec-mocks (~> 3.9.0)
46
+ rspec-core (3.9.0)
47
+ rspec-support (~> 3.9.0)
48
+ rspec-expectations (3.9.0)
50
49
  diff-lcs (>= 1.2.0, < 2.0)
51
- rspec-support (~> 3.8.0)
52
- rspec-mocks (3.8.0)
50
+ rspec-support (~> 3.9.0)
51
+ rspec-mocks (3.9.0)
53
52
  diff-lcs (>= 1.2.0, < 2.0)
54
- rspec-support (~> 3.8.0)
55
- rspec-support (3.8.0)
56
- rubocop (0.65.0)
53
+ rspec-support (~> 3.9.0)
54
+ rspec-support (3.9.0)
55
+ rubocop (0.75.1)
57
56
  jaro_winkler (~> 1.5.1)
58
57
  parallel (~> 1.10)
59
- parser (>= 2.5, != 2.5.1.1)
60
- powerpack (~> 0.1)
61
- psych (>= 3.1.0)
58
+ parser (>= 2.6)
62
59
  rainbow (>= 2.2.2, < 4.0)
63
60
  ruby-progressbar (~> 1.7)
64
- unicode-display_width (~> 1.4.0)
65
- rubocop-rspec (1.32.0)
66
- rubocop (>= 0.60.0)
67
- ruby-progressbar (1.10.0)
68
- shoulda-matchers (4.0.1)
69
- activesupport (>= 4.2.0)
61
+ unicode-display_width (>= 1.4.0, < 1.7)
62
+ rubocop-rspec (1.36.0)
63
+ rubocop (>= 0.68.1)
64
+ ruby-progressbar (1.10.1)
70
65
  thread_safe (0.3.6)
71
66
  typhoeus (1.3.1)
72
67
  ethon (>= 0.9.0)
73
68
  tzinfo (1.2.5)
74
69
  thread_safe (~> 0.1)
75
- unicode-display_width (1.4.1)
70
+ unicode-display_width (1.6.0)
71
+ zeitwerk (2.2.0)
76
72
 
77
73
  PLATFORMS
78
74
  ruby
@@ -80,13 +76,12 @@ PLATFORMS
80
76
  DEPENDENCIES
81
77
  bundler (~> 2.0)
82
78
  dotenv (~> 2.5)
83
- factory_bot (~> 4.8)
79
+ factory_bot (~> 4.11)
84
80
  faker (~> 1.9)
85
81
  rake (~> 10.0)
86
82
  rspec (~> 3.0)
87
83
  rubocop-rspec (~> 1.32)
88
- shoulda-matchers (~> 4.0)
89
84
  xpanse_2go!
90
85
 
91
86
  BUNDLED WITH
92
- 2.0.1
87
+ 2.0.2
data/README.md CHANGED
@@ -48,8 +48,8 @@ Or install it yourself as:
48
48
  [x] Xpanse2go::PackageItem
49
49
  [x] Add Typhoeus sample
50
50
  [] Add Typhoeus and connect to the Sandbox
51
- [] xport.it
52
- [] Receive webhook updates
53
- [] Create xport.it microservice
54
- [] Generating AWB indexes
55
- [] Fetching an available AWB
51
+ [x] xport.it
52
+ [x] Receive webhook updates
53
+ [x] Create xport.it microservice
54
+ [x] Generating AWB indexes
55
+ [x] Fetching an available AWB
data/Rakefile CHANGED
File without changes
Binary file
Binary file
Binary file
Binary file
data/lib/xpanse_2go.rb CHANGED
@@ -2,6 +2,7 @@ module Xpanse2go
2
2
  autoload :Configuration, 'xpanse_2go/configuration'
3
3
 
4
4
  autoload :Order, 'xpanse_2go/order'
5
+ autoload :Orders, 'xpanse_2go/orders'
5
6
  autoload :Address, 'xpanse_2go/address'
6
7
  autoload :Package, 'xpanse_2go/package'
7
8
  autoload :PackageItem, 'xpanse_2go/package_item'
@@ -16,9 +17,9 @@ module Xpanse2go
16
17
 
17
18
  def self.url
18
19
  if Xpanse2go.configuration.production
19
- 'https://expressapps.2go.com.ph/2goweb'
20
+ 'https://expressapps.2go.com.ph/2goweb/model/api'
20
21
  else
21
- 'https://expressapps.2go.com.ph/2gowebdev'
22
+ 'https://expressapps.2go.com.ph/2gowebdev/model/api'
22
23
  end
23
24
  end
24
25
  end
File without changes
@@ -1,12 +1,13 @@
1
1
  module Xpanse2go
2
2
  class Configuration
3
- attr_accessor :account_id, :account_number, :token, :production
3
+ attr_accessor :account_id, :account_number, :account_number_cod, :token, :production
4
4
 
5
5
  def initialize
6
- @account_id = 'XPANSE'
7
- @token = 'bVHQGxZLML'
8
- @account_number = '1'
9
- @production = false
6
+ @account_id = 'XPANSE'
7
+ @token = 'bVHQGxZLML'
8
+ @account_number = '1'
9
+ @account_number_cod = '1'
10
+ @production = false
10
11
  end
11
12
  end
12
13
  end
File without changes
@@ -0,0 +1,90 @@
1
+ require 'json'
2
+ require 'typhoeus'
3
+
4
+ module Xpanse2go
5
+ class Orders
6
+ def self.sample_order
7
+ delivery_address = Xpanse2go::Address.new(
8
+ customer_name: 'Rick Sanchez',
9
+ line1: '23F Giza Bldg., Egypt St.',
10
+ barangay: 'Better Living',
11
+ city: 'Paranaque City',
12
+ country: 'Philippines',
13
+ zip_code: '1600',
14
+ mobile_number: '09281234567',
15
+ email_address: 'ricksanchez@gmail.com')
16
+
17
+ pickup_address = Xpanse2go::Address.new(
18
+ customer_name: 'Juan dela Cruz',
19
+ line1: 'L10 B20 Putatan Village',
20
+ barangay: 'Putatan',
21
+ city: 'Muntinlupa City',
22
+ country: 'Philippines',
23
+ zip_code: '1958',
24
+ mobile_number: '09281234567',
25
+ email_address: 'juan_delacruz@yahoo.com.ph')
26
+
27
+ item = Xpanse2go::PackageItem.new(
28
+ quantity: 1,
29
+ package_code: 'BOX',
30
+ weight: 5,
31
+ length: 5,
32
+ width: 5,
33
+ height: 5,
34
+ declared_value: 1000,
35
+ description: 'Cellular phone unit')
36
+ package = Xpanse2go::Package.new.add_item(item)
37
+
38
+ order = Xpanse2go::Order.new(delivery_address, pickup_address, package,
39
+ reference_number: '123', awb: '123')
40
+ end
41
+
42
+ def self.request_awb(reference_number)
43
+ headers = { 'Content-Type': 'application/json' }
44
+ req_url = 'https://xport.it/2go/request_awb'
45
+ req_options = { headers: headers, body: { 'reference_number': reference_number }.to_json }
46
+
47
+ res = Typhoeus::Request.post(req_url, req_options).body
48
+ JSON.parse(res, symbolize_names: true)
49
+ end
50
+
51
+ def self.create_order(delivery_address, pickup_address, package, reference_number, awb)
52
+ raise 'Not a valid order object' unless order.is_a?(Xpanse2go::Order)
53
+
54
+ order = Xpanse2go::Order.new(
55
+ delivery_address: delivery_address,
56
+ pickup_address: pickup_address,
57
+ package: package,
58
+ reference_number: reference_number,
59
+ awb: awb)
60
+
61
+ raise 'Order invalid' unless order.valid?
62
+
63
+ headers = { 'Content-Type': 'application/json' }
64
+ req_url = "#{Xpanse2go.url}/shipment_request.asmx/Create"
65
+ req_options = { headers: headers, body: order.to_json }
66
+
67
+ res = Typhoeus::Request.post(req_url, req_options).body
68
+ JSON.parse(res, symbolize_names: true)
69
+ end
70
+
71
+ def self.track_order(awb_numbers)
72
+ awb_numbers = [awb_numbers] if awb_numbers.is_a?(String)
73
+
74
+ awb_request = {
75
+ 'd': {
76
+ "id_": Xpanse2go.configuration.account_id,
77
+ "token_": Xpanse2go.configuration.token,
78
+ "tracking_no": awb_numbers
79
+ }
80
+ }
81
+
82
+ headers = { 'Content-Type': 'application/json' }
83
+ req_url = "#{Xpanse2go.url}/shipment_update.asmx/track"
84
+ req_options = { headers: headers, body: awb_request.to_json }
85
+
86
+ res = Typhoeus::Request.post(req_url, req_options).body
87
+ JSON.parse(res, symbolize_names: true)
88
+ end
89
+ end
90
+ end
File without changes
File without changes
@@ -1,3 +1,3 @@
1
1
  module Xpanse2go
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
Binary file
Binary file
data/xpanse_2go.gemspec CHANGED
@@ -22,13 +22,13 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ['lib']
24
24
 
25
- spec.add_dependency 'activemodel', '~> 5.1'
25
+ spec.add_dependency 'activemodel', '~> 6.0'
26
26
  spec.add_dependency 'fast_jsonapi', '~> 1.3'
27
27
  spec.add_dependency 'typhoeus', '~> 1.3'
28
28
 
29
29
  spec.add_development_dependency 'bundler', '~> 2.0'
30
30
  spec.add_development_dependency 'dotenv', '~> 2.5'
31
- spec.add_development_dependency 'factory_bot', '~> 4.8'
31
+ spec.add_development_dependency 'factory_bot', '~> 4.11'
32
32
  spec.add_development_dependency 'faker', '~> 1.9'
33
33
  spec.add_development_dependency 'rake', '~> 10.0'
34
34
  spec.add_development_dependency 'rspec', '~> 3.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xpanse_2go
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Marquez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-21 00:00:00.000000000 Z
11
+ date: 2019-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.1'
19
+ version: '6.0'
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: '5.1'
26
+ version: '6.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: fast_jsonapi
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '4.8'
89
+ version: '4.11'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '4.8'
96
+ version: '4.11'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: faker
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -170,13 +170,21 @@ files:
170
170
  - Rakefile
171
171
  - bin/console
172
172
  - bin/setup
173
+ - docs/2GO Group Express APIs.pdf
174
+ - docs/2GO_Xpanse_LocationMatrix_10april2019.xlsx
175
+ - docs/Shipment Request API.pdf
176
+ - docs/Shipment Update API v2.doc.pdf
177
+ - docs/Shipment Update WebHook.pdf
173
178
  - lib/xpanse_2go.rb
174
179
  - lib/xpanse_2go/address.rb
175
180
  - lib/xpanse_2go/configuration.rb
176
181
  - lib/xpanse_2go/order.rb
182
+ - lib/xpanse_2go/orders.rb
177
183
  - lib/xpanse_2go/package.rb
178
184
  - lib/xpanse_2go/package_item.rb
179
185
  - lib/xpanse_2go/version.rb
186
+ - xpanse_2go-0.1.0.gem
187
+ - xpanse_2go-0.1.1.gem
180
188
  - xpanse_2go.gemspec
181
189
  homepage: https://rubygems.org/gems/xpanse_2go
182
190
  licenses: []
@@ -196,8 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
204
  - !ruby/object:Gem::Version
197
205
  version: '0'
198
206
  requirements: []
199
- rubyforge_project:
200
- rubygems_version: 2.7.8
207
+ rubygems_version: 3.0.1
201
208
  signing_key:
202
209
  specification_version: 4
203
210
  summary: 2GO Ruby API