sendle-api 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +5 -0
- data/lib/sendle/api/actions/create.rb +0 -6
- data/lib/sendle/api/constants.rb +21 -4
- data/lib/sendle/api/quote.rb +1 -1
- data/lib/sendle/api/version.rb +1 -1
- data/spec/sendle/api/quote_spec.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 939e17d825cb0f844980e6bc3ca323966e16f79b
|
4
|
+
data.tar.gz: 97c59b2cfe9d7f602abcb864d96726150d9cf3c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 770c10b0e3cc0bcfd6c1882984d10124460bd85226de85791345a4769a892924ccbf20c87c7817aa91c2ae5e2b21361ae66e6f4e9e1695e61aac2a76be99ce03
|
7
|
+
data.tar.gz: 23ee31806fed88dccb02f27427c6bdb9150b2299e83f02d079ac5a07d6744e13ced10b06479987542caa0017cc2f59e153ec3ad3c725c9592b7c30f637423032
|
data/Changelog.md
CHANGED
data/lib/sendle/api/constants.rb
CHANGED
@@ -1,4 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module Sendle
|
2
|
+
module Api
|
3
|
+
PLAN_EASY = 'easy'
|
4
|
+
PLAN_PREMIUM = 'premium'
|
5
|
+
PLAN_PRO = 'pro'
|
6
|
+
PLANS = [ PLAN_EASY, PLAN_PREMIUM, PLAN_PRO ]
|
7
|
+
|
8
|
+
ORDER_STATUS_PAYMENT = 'Payment'
|
9
|
+
ORDER_STATUS_PICKUP = 'Pickup'
|
10
|
+
ORDER_STATUS_IN_TRANSIT = 'In Transit'
|
11
|
+
ORDER_STATUS_DELIVERED = 'Delivered'
|
12
|
+
ORDER_STATUS_CANCELLED = 'Cancelled'
|
13
|
+
ORDER_STATUSES = [ ORDER_STATUS_PAYMENT,
|
14
|
+
ORDER_STATUS_PICKUP,
|
15
|
+
ORDER_STATUS_IN_TRANSIT,
|
16
|
+
ORDER_STATUS_DELIVERED,
|
17
|
+
ORDER_STATUS_CANCELLED
|
18
|
+
]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
data/lib/sendle/api/quote.rb
CHANGED
@@ -21,7 +21,7 @@ class Sendle::Api::Quote < Sendle::Api::Resource
|
|
21
21
|
# Checking for valid plan_name, if passed in
|
22
22
|
if params[:plan_name]
|
23
23
|
plan_name = params[:plan_name]
|
24
|
-
raise Sendle::Api::Errors::InvalidPlan.new(plan_name) unless PLANS.include?(plan_name)
|
24
|
+
raise Sendle::Api::Errors::InvalidPlan.new(plan_name) unless Sendle::Api::PLANS.include?(plan_name)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
data/lib/sendle/api/version.rb
CHANGED
@@ -44,7 +44,7 @@ describe Sendle::Api::Quote do
|
|
44
44
|
|
45
45
|
context "passing in a plan_name" do
|
46
46
|
it "checks a valid plan name is passed in" do
|
47
|
-
PLANS.each do |plan|
|
47
|
+
Sendle::Api::PLANS.each do |plan|
|
48
48
|
params[:plan_name] = plan
|
49
49
|
expect(RestClient::Request).to receive(:execute).and_return(QUOTE_NO_PLAN_RESPONSE)
|
50
50
|
Sendle::Api::Quote.execute(params)
|
@@ -64,12 +64,12 @@ describe Sendle::Api::Quote do
|
|
64
64
|
headers: {
|
65
65
|
accept: :json,
|
66
66
|
content_type: :json,
|
67
|
-
params: params.merge(plan_name: PLAN_EASY)
|
67
|
+
params: params.merge(plan_name: Sendle::Api::PLAN_EASY)
|
68
68
|
}
|
69
69
|
}
|
70
70
|
expect(RestClient::Request).to receive(:execute).with(hash_including(expected_params)).and_return(QUOTE_NO_PLAN_RESPONSE)
|
71
71
|
|
72
|
-
Sendle::Api::Quote.execute(params.merge(plan_name: PLAN_EASY))
|
72
|
+
Sendle::Api::Quote.execute(params.merge(plan_name: Sendle::Api::PLAN_EASY))
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|