sendle_api 0.1.4 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dev/config.rb +4 -2
- data/lib/dev/zeitwerk_loader.rb +3 -1
- data/lib/sendle_api/configuration.rb +2 -0
- data/lib/sendle_api/resources/address.rb +4 -2
- data/lib/sendle_api/resources/base.rb +1 -0
- data/lib/sendle_api/resources/contact.rb +3 -1
- data/lib/sendle_api/resources/order.rb +6 -5
- data/lib/sendle_api/resources/receiver.rb +3 -1
- data/lib/sendle_api/resources/sender.rb +7 -5
- data/lib/sendle_api/resources/tracking.rb +2 -0
- data/lib/sendle_api/resources/volume.rb +5 -3
- data/lib/sendle_api/resources/weight.rb +4 -3
- data/lib/sendle_api/version.rb +1 -1
- data/lib/sendle_api.rb +2 -3
- data/sendle_api.gemspec +5 -5
- metadata +31 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e44918e10ca83b0d05d242cbf0311c79e84b8e80a0618be6e099d300da2f4ac
|
4
|
+
data.tar.gz: 4aa87b10d953856785402638e155202405b98d8d61757ed7144b415db3cfe80b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7baa761f0218c16a39e60eb7ddfc51db5e389cdfa38d91a9532d318ddbb79c8318f1ae0d037a2d8ef81a23b6295ac85f203973678d7861af10fa51b2f78c0746
|
7
|
+
data.tar.gz: 8562dd99a2dedaa8249b25a8c02cdd105e20c632bb1800357a26243fd4fb0253a4ab981b3265e9cee333f10c73b862be33f0ef4b9171120174eb02caf91da343
|
data/lib/dev/config.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "dotenv/load"
|
2
4
|
|
3
5
|
def set_config
|
4
6
|
SendleAPI.configure do |config|
|
5
|
-
config.sendle_id = ENV["SENDLE_ID"]
|
7
|
+
config.sendle_id = ENV["SENDLE_ID"]
|
6
8
|
config.api_key = ENV["SENDLE_API_KEY"]
|
7
9
|
config.testing = true
|
8
10
|
end
|
9
|
-
end
|
11
|
+
end
|
data/lib/dev/zeitwerk_loader.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "zeitwerk"
|
2
4
|
require_relative "config"
|
3
5
|
|
4
6
|
loader = Zeitwerk::Loader.for_gem
|
5
7
|
loader.inflector.inflect(
|
6
|
-
"sendle_api" => "SendleAPI"
|
8
|
+
"sendle_api" => "SendleAPI",
|
7
9
|
)
|
8
10
|
loader.push_dir("./lib")
|
9
11
|
loader.collapse("./lib/sendle_api/resources")
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SendleAPI
|
2
4
|
class Address < Base
|
3
5
|
include NotSaveable
|
@@ -7,9 +9,9 @@ module SendleAPI
|
|
7
9
|
suburb: nil,
|
8
10
|
state_name: nil,
|
9
11
|
postcode: nil,
|
10
|
-
country: nil
|
12
|
+
country: nil,
|
11
13
|
}
|
12
14
|
|
13
15
|
validates :address_line1, :suburb, :state_name, :postcode, :country, presence: true
|
14
16
|
end
|
15
|
-
end
|
17
|
+
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "digest/sha1"
|
2
4
|
|
3
5
|
module SendleAPI
|
4
6
|
class Order < Base
|
@@ -8,7 +10,7 @@ module SendleAPI
|
|
8
10
|
has_one :receiver, class_name: Receiver
|
9
11
|
|
10
12
|
validates :description, :weight, :sender, :receiver, presence: true
|
11
|
-
validates :first_mile_option, inclusion: { in: ["pickup", "drop off"]}
|
13
|
+
validates :first_mile_option, inclusion: { in: ["pickup", "drop off"] }
|
12
14
|
|
13
15
|
DEFAULT_ATTRS = {
|
14
16
|
pickup_date: nil,
|
@@ -20,7 +22,7 @@ module SendleAPI
|
|
20
22
|
weight: Weight.new,
|
21
23
|
volume: Volume.new,
|
22
24
|
sender: Sender.new,
|
23
|
-
receiver: Receiver.new
|
25
|
+
receiver: Receiver.new,
|
24
26
|
}
|
25
27
|
|
26
28
|
CHILD_OBJECT_KEYS_FOR_VALIDATION = [:weight, :volume, :sender, :receiver]
|
@@ -47,8 +49,7 @@ module SendleAPI
|
|
47
49
|
end
|
48
50
|
|
49
51
|
def set_idempotency_key_header
|
50
|
-
self.class.headers.merge!("Idempotency-Key": Digest::SHA1.hexdigest(
|
52
|
+
self.class.headers.merge!("Idempotency-Key": Digest::SHA1.hexdigest(encode))
|
51
53
|
end
|
52
|
-
|
53
54
|
end
|
54
55
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SendleAPI
|
2
4
|
class Receiver < Base
|
3
5
|
include NotSaveable
|
@@ -10,7 +12,7 @@ module SendleAPI
|
|
10
12
|
DEFAULT_ATTRS = {
|
11
13
|
contact: Contact.new,
|
12
14
|
address: Address.new,
|
13
|
-
instructions: ""
|
15
|
+
instructions: "",
|
14
16
|
}
|
15
17
|
|
16
18
|
CHILD_OBJECT_KEYS_FOR_VALIDATION = [:contact, :address]
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SendleAPI
|
2
4
|
class Sender < Base
|
3
5
|
include NotSaveable
|
@@ -7,11 +9,11 @@ module SendleAPI
|
|
7
9
|
|
8
10
|
validates :contact, :address, presence: true
|
9
11
|
validate :address_country_valid
|
10
|
-
|
12
|
+
|
11
13
|
DEFAULT_ATTRS = {
|
12
14
|
contact: Contact.new,
|
13
15
|
address: Address.new,
|
14
|
-
instructions: ""
|
16
|
+
instructions: "",
|
15
17
|
}
|
16
18
|
|
17
19
|
CHILD_OBJECT_KEYS_FOR_VALIDATION = [:contact, :address]
|
@@ -20,9 +22,9 @@ module SendleAPI
|
|
20
22
|
|
21
23
|
def address_country_valid
|
22
24
|
return unless address
|
23
|
-
|
24
|
-
valid_sender_countries = [
|
25
|
-
unless valid_sender_countries.include?
|
25
|
+
|
26
|
+
valid_sender_countries = ["AU", "US", "Australia", "United States"]
|
27
|
+
unless valid_sender_countries.include?(address.country)
|
26
28
|
errors.add(:sender_address_country, "Must be from #{valid_sender_countries}")
|
27
29
|
end
|
28
30
|
end
|
@@ -1,11 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SendleAPI
|
2
4
|
class Volume < Base
|
3
5
|
include NotSaveable
|
4
6
|
|
5
7
|
DEFAULT_ATTRS = {
|
6
8
|
value: nil,
|
7
|
-
units: nil
|
9
|
+
units: nil,
|
8
10
|
}
|
9
|
-
validates :units, inclusion: { in:
|
11
|
+
validates :units, inclusion: { in: ["m3", "in3"] }, if: -> { value.present? }
|
10
12
|
end
|
11
|
-
end
|
13
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
module SendleAPI
|
3
4
|
class Weight < Base
|
@@ -5,10 +6,10 @@ module SendleAPI
|
|
5
6
|
|
6
7
|
DEFAULT_ATTRS = {
|
7
8
|
value: nil,
|
8
|
-
units: nil
|
9
|
+
units: nil,
|
9
10
|
}
|
10
11
|
|
11
12
|
validates :value, presence: true
|
12
|
-
validates :units, inclusion: { in:
|
13
|
+
validates :units, inclusion: { in: ["lb", "kg"] }
|
13
14
|
end
|
14
|
-
end
|
15
|
+
end
|
data/lib/sendle_api/version.rb
CHANGED
data/lib/sendle_api.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "sendle_api/version"
|
2
4
|
require "active_resource"
|
3
5
|
|
4
6
|
module SendleAPI
|
5
|
-
require "phonelib"
|
6
|
-
require "countries"
|
7
|
-
|
8
7
|
require "sendle_api/configuration"
|
9
8
|
require "sendle_api/not_saveable"
|
10
9
|
require "sendle_api/errors"
|
data/sendle_api.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require_relative "lib/sendle_api/version"
|
3
4
|
|
4
5
|
Gem::Specification.new do |spec|
|
@@ -28,15 +29,14 @@ Gem::Specification.new do |spec|
|
|
28
29
|
spec.require_paths = ["lib"]
|
29
30
|
|
30
31
|
spec.add_dependency("activeresource", ">= 4.1.0")
|
31
|
-
spec.add_dependency("countries", "~> 3.0")
|
32
|
-
spec.add_dependency("phonelib", "~> 0.6")
|
33
32
|
|
34
|
-
spec.add_development_dependency("rspec", "~> 3.2")
|
35
33
|
spec.add_development_dependency("dotenv")
|
36
|
-
spec.add_development_dependency("pry-byebug")
|
37
|
-
spec.add_development_dependency("pry")
|
38
34
|
spec.add_development_dependency("guard-rspec")
|
35
|
+
spec.add_development_dependency("pry")
|
36
|
+
spec.add_development_dependency("pry-byebug")
|
37
|
+
spec.add_development_dependency("rspec", "~> 3.2")
|
39
38
|
spec.add_development_dependency("rubocop")
|
40
39
|
spec.add_development_dependency("rubocop-shopify")
|
40
|
+
spec.add_development_dependency("zeitwerk", "~> 2.1", ">= 2.1.8")
|
41
41
|
spec.metadata["rubygems_mfa_required"] = "true"
|
42
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sendle_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Chong
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -25,49 +25,35 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 4.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '3.0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '3.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: phonelib
|
28
|
+
name: dotenv
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
|
-
- - "
|
31
|
+
- - ">="
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0
|
48
|
-
type: :
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
|
-
- - "
|
38
|
+
- - ">="
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0
|
40
|
+
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
42
|
+
name: guard-rspec
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
|
-
- - "
|
45
|
+
- - ">="
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
47
|
+
version: '0'
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
|
-
- - "
|
52
|
+
- - ">="
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
54
|
+
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
56
|
+
name: pry
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
59
|
- - ">="
|
@@ -95,21 +81,21 @@ dependencies:
|
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: '0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
84
|
+
name: rspec
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
|
-
- - "
|
87
|
+
- - "~>"
|
102
88
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
89
|
+
version: '3.2'
|
104
90
|
type: :development
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
|
-
- - "
|
94
|
+
- - "~>"
|
109
95
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
96
|
+
version: '3.2'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
98
|
+
name: rubocop
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
101
|
- - ">="
|
@@ -123,7 +109,7 @@ dependencies:
|
|
123
109
|
- !ruby/object:Gem::Version
|
124
110
|
version: '0'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
|
-
name: rubocop
|
112
|
+
name: rubocop-shopify
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
128
114
|
requirements:
|
129
115
|
- - ">="
|
@@ -137,19 +123,25 @@ dependencies:
|
|
137
123
|
- !ruby/object:Gem::Version
|
138
124
|
version: '0'
|
139
125
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
126
|
+
name: zeitwerk
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
142
128
|
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.1'
|
143
132
|
- - ">="
|
144
133
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
134
|
+
version: 2.1.8
|
146
135
|
type: :development
|
147
136
|
prerelease: false
|
148
137
|
version_requirements: !ruby/object:Gem::Requirement
|
149
138
|
requirements:
|
139
|
+
- - "~>"
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '2.1'
|
150
142
|
- - ">="
|
151
143
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
144
|
+
version: 2.1.8
|
153
145
|
description:
|
154
146
|
email:
|
155
147
|
- andygg1996personal@gmail.com
|
@@ -211,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
203
|
- !ruby/object:Gem::Version
|
212
204
|
version: '0'
|
213
205
|
requirements: []
|
214
|
-
rubygems_version: 3.2.
|
206
|
+
rubygems_version: 3.2.33
|
215
207
|
signing_key:
|
216
208
|
specification_version: 4
|
217
209
|
summary: Ruby object based Sendle API wrapper.
|