shipcloud 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.rubocop.yml +65 -49
- data/.ruby-version +1 -0
- data/.travis.yml +17 -11
- data/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/install-cc-test-reporter.sh +4 -0
- data/lib/shipcloud/address.rb +1 -0
- data/lib/shipcloud/shipment.rb +2 -1
- data/lib/shipcloud/version.rb +1 -1
- data/lib/shipcloud/webhook.rb +1 -1
- data/shipcloud.gemspec +5 -6
- data/spec/shipcloud/address_spec.rb +27 -0
- data/spec/shipcloud/request/connection_spec.rb +3 -3
- data/spec/shipcloud/shipment_spec.rb +11 -3
- data/spec/shipcloud/webhooks_spec.rb +2 -0
- data/spec/shipcloud_spec.rb +15 -4
- metadata +12 -36
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: b38e4cfb0f461ac7d56789bd8da7509f34ccc79a4d676c953e75569a9c4806d2
|
|
4
|
+
data.tar.gz: defc12ded3f435dd7ac09ca390d480213fe11bdc17ac8b28861364afbd3cc1da
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 21265a7e3ee0ca03e467eb28034bb20092fc04ea24a29646717afaf1caef4a14b0a19460a60fe0197143c1b43f835e099e53d148bc41cf53685277c7007ad7ae
|
|
7
|
+
data.tar.gz: 676ae0f2669f1864cc0187800501805ac0494624a3d226822efb9fef27a3c64318b57a8a3aeca52dc7d05950c90a0366b7b5eaf2070336bb8c9ac66d45645386
|
data/.rubocop.yml
CHANGED
|
@@ -1,13 +1,44 @@
|
|
|
1
1
|
AllCops:
|
|
2
|
-
TargetRubyVersion: 2.
|
|
2
|
+
TargetRubyVersion: 2.5
|
|
3
3
|
Exclude:
|
|
4
4
|
- vendor/**/*
|
|
5
|
-
- db/schema.rb
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
Naming/AccessorMethodName:
|
|
8
7
|
Description: Check the naming of accessor methods for get_/set_.
|
|
9
8
|
Enabled: false
|
|
10
9
|
|
|
10
|
+
Naming/AsciiIdentifiers:
|
|
11
|
+
Description: 'Use only ascii symbols in identifiers.'
|
|
12
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
|
|
13
|
+
Enabled: false
|
|
14
|
+
|
|
15
|
+
Naming/FileName:
|
|
16
|
+
Description: 'Use snake_case for source file names.'
|
|
17
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
|
|
18
|
+
Enabled: false
|
|
19
|
+
|
|
20
|
+
Naming/BinaryOperatorParameterName:
|
|
21
|
+
Description: 'When defining binary operators, name the argument other.'
|
|
22
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg'
|
|
23
|
+
Enabled: false
|
|
24
|
+
|
|
25
|
+
Naming/MemoizedInstanceVariableName:
|
|
26
|
+
Description: Memoized method name should match memo instance variable name.
|
|
27
|
+
Enabled: true
|
|
28
|
+
EnforcedStyleForLeadingUnderscores: required
|
|
29
|
+
|
|
30
|
+
Naming/PredicateName:
|
|
31
|
+
Description: 'Check the names of predicate methods.'
|
|
32
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark'
|
|
33
|
+
NamePrefix:
|
|
34
|
+
- is_
|
|
35
|
+
- has_
|
|
36
|
+
- have_
|
|
37
|
+
NamePrefixBlacklist:
|
|
38
|
+
- is_
|
|
39
|
+
Exclude:
|
|
40
|
+
- spec/**/*
|
|
41
|
+
|
|
11
42
|
Style/Alias:
|
|
12
43
|
Description: 'Use alias_method instead of alias.'
|
|
13
44
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#alias-method'
|
|
@@ -23,11 +54,6 @@ Style/AsciiComments:
|
|
|
23
54
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
|
|
24
55
|
Enabled: false
|
|
25
56
|
|
|
26
|
-
Style/AsciiIdentifiers:
|
|
27
|
-
Description: 'Use only ascii symbols in identifiers.'
|
|
28
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
|
|
29
|
-
Enabled: false
|
|
30
|
-
|
|
31
57
|
Style/Attr:
|
|
32
58
|
Description: 'Checks for uses of Module#attr.'
|
|
33
59
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr'
|
|
@@ -107,11 +133,6 @@ Style/EvenOdd:
|
|
|
107
133
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
|
|
108
134
|
Enabled: false
|
|
109
135
|
|
|
110
|
-
Style/FileName:
|
|
111
|
-
Description: 'Use snake_case for source file names.'
|
|
112
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
|
|
113
|
-
Enabled: false
|
|
114
|
-
|
|
115
136
|
Style/FlipFlop:
|
|
116
137
|
Description: 'Checks for flip flops'
|
|
117
138
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
|
|
@@ -139,7 +160,6 @@ Style/IfUnlessModifier:
|
|
|
139
160
|
single-line body.
|
|
140
161
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
|
|
141
162
|
Enabled: false
|
|
142
|
-
MaxLineLength: 80
|
|
143
163
|
|
|
144
164
|
Style/IfWithSemicolon:
|
|
145
165
|
Description: 'Do not use if x; .... Use the ternary operator instead.'
|
|
@@ -150,6 +170,10 @@ Style/InlineComment:
|
|
|
150
170
|
Description: 'Avoid inline comments.'
|
|
151
171
|
Enabled: false
|
|
152
172
|
|
|
173
|
+
Style/IpAddresses:
|
|
174
|
+
Description: "Don't include literal IP addresses in code."
|
|
175
|
+
Enabled: true
|
|
176
|
+
|
|
153
177
|
Style/Lambda:
|
|
154
178
|
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
|
155
179
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#lambda-multi-line'
|
|
@@ -217,11 +241,6 @@ Style/OneLineConditional:
|
|
|
217
241
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator'
|
|
218
242
|
Enabled: false
|
|
219
243
|
|
|
220
|
-
Style/OpMethod:
|
|
221
|
-
Description: 'When defining binary operators, name the argument other.'
|
|
222
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg'
|
|
223
|
-
Enabled: false
|
|
224
|
-
|
|
225
244
|
Style/PercentLiteralDelimiters:
|
|
226
245
|
Description: 'Use `%`-literal delimiters consistently'
|
|
227
246
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-literal-braces'
|
|
@@ -232,18 +251,6 @@ Style/PerlBackrefs:
|
|
|
232
251
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
|
|
233
252
|
Enabled: false
|
|
234
253
|
|
|
235
|
-
Style/PredicateName:
|
|
236
|
-
Description: 'Check the names of predicate methods.'
|
|
237
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark'
|
|
238
|
-
NamePrefix:
|
|
239
|
-
- is_
|
|
240
|
-
- has_
|
|
241
|
-
- have_
|
|
242
|
-
NamePrefixBlacklist:
|
|
243
|
-
- is_
|
|
244
|
-
Exclude:
|
|
245
|
-
- spec/**/*
|
|
246
|
-
|
|
247
254
|
Style/Proc:
|
|
248
255
|
Description: 'Use proc instead of Proc.new.'
|
|
249
256
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc'
|
|
@@ -315,8 +322,18 @@ Style/TrailingCommaInArguments:
|
|
|
315
322
|
- no_comma
|
|
316
323
|
Enabled: true
|
|
317
324
|
|
|
318
|
-
Style/
|
|
319
|
-
Description: 'Checks for trailing comma in array
|
|
325
|
+
Style/TrailingCommaInArrayLiteral:
|
|
326
|
+
Description: 'Checks for trailing comma in array literals.'
|
|
327
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
|
328
|
+
EnforcedStyleForMultiline: comma
|
|
329
|
+
SupportedStylesForMultiline:
|
|
330
|
+
- comma
|
|
331
|
+
- consistent_comma
|
|
332
|
+
- no_comma
|
|
333
|
+
Enabled: true
|
|
334
|
+
|
|
335
|
+
Style/TrailingCommaInHashLiteral:
|
|
336
|
+
Description: 'Checks for trailing comma in hash literals.'
|
|
320
337
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
|
321
338
|
EnforcedStyleForMultiline: comma
|
|
322
339
|
SupportedStylesForMultiline:
|
|
@@ -366,6 +383,13 @@ Style/OptionHash:
|
|
|
366
383
|
|
|
367
384
|
# Layout
|
|
368
385
|
|
|
386
|
+
Layout/ConditionPosition:
|
|
387
|
+
Description: >-
|
|
388
|
+
Checks for condition placed in a confusing position relative to
|
|
389
|
+
the keyword.
|
|
390
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
|
|
391
|
+
Enabled: false
|
|
392
|
+
|
|
369
393
|
Layout/DotPosition:
|
|
370
394
|
Description: 'Checks the position of the dot in multi-line method calls.'
|
|
371
395
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
|
|
@@ -439,14 +463,7 @@ Lint/AssignmentInCondition:
|
|
|
439
463
|
|
|
440
464
|
Lint/CircularArgumentReference:
|
|
441
465
|
Description: "Don't refer to the keyword argument in the default value."
|
|
442
|
-
Enabled:
|
|
443
|
-
|
|
444
|
-
Lint/ConditionPosition:
|
|
445
|
-
Description: >-
|
|
446
|
-
Checks for condition placed in a confusing position relative to
|
|
447
|
-
the keyword.
|
|
448
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
|
|
449
|
-
Enabled: false
|
|
466
|
+
Enabled: true
|
|
450
467
|
|
|
451
468
|
Lint/DeprecatedClassMethods:
|
|
452
469
|
Description: 'Check for deprecated class method calls.'
|
|
@@ -473,13 +490,7 @@ Lint/HandleExceptions:
|
|
|
473
490
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
|
|
474
491
|
Enabled: false
|
|
475
492
|
|
|
476
|
-
Lint/
|
|
477
|
-
Description: >-
|
|
478
|
-
Checks for invalid character literals with a non-escaped
|
|
479
|
-
whitespace character.
|
|
480
|
-
Enabled: false
|
|
481
|
-
|
|
482
|
-
Lint/LiteralInCondition:
|
|
493
|
+
Lint/LiteralAsCondition:
|
|
483
494
|
Description: 'Checks of literals used in conditions.'
|
|
484
495
|
Enabled: false
|
|
485
496
|
|
|
@@ -520,7 +531,7 @@ Lint/UnderscorePrefixedVariableName:
|
|
|
520
531
|
Description: 'Do not use prefix `_` for a variable that is used.'
|
|
521
532
|
Enabled: false
|
|
522
533
|
|
|
523
|
-
Lint/
|
|
534
|
+
Lint/UnneededCopDisableDirective:
|
|
524
535
|
Description: >-
|
|
525
536
|
Checks for rubocop:disable comments that can be removed.
|
|
526
537
|
Note: this cop is not disabled when disabling all cops.
|
|
@@ -543,6 +554,7 @@ Metrics/BlockLength:
|
|
|
543
554
|
Description: 'Avoid long blocks with many lines.'
|
|
544
555
|
Enabled: true
|
|
545
556
|
Exclude:
|
|
557
|
+
- "gems/**/*_spec.rb"
|
|
546
558
|
- "spec/**/*"
|
|
547
559
|
- "config/routes.rb"
|
|
548
560
|
|
|
@@ -636,6 +648,10 @@ Performance/StringReplacement:
|
|
|
636
648
|
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
|
|
637
649
|
Enabled: false
|
|
638
650
|
|
|
651
|
+
Performance/UnfreezeString:
|
|
652
|
+
Description: 'Use unary plus to get an unfrozen string literal.'
|
|
653
|
+
Enabled: false
|
|
654
|
+
|
|
639
655
|
# Rails
|
|
640
656
|
|
|
641
657
|
Rails/ActionFilter:
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.5.3
|
data/.travis.yml
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
sudo: false
|
|
2
2
|
language: ruby
|
|
3
|
+
cache: bundler
|
|
3
4
|
rvm:
|
|
4
|
-
- 2.
|
|
5
|
-
- 2.
|
|
6
|
-
- 2.
|
|
7
|
-
- 2.
|
|
5
|
+
- 2.2
|
|
6
|
+
- 2.3
|
|
7
|
+
- 2.4
|
|
8
|
+
- 2.5
|
|
9
|
+
- 2.6
|
|
10
|
+
- ruby-head
|
|
11
|
+
- jruby
|
|
12
|
+
- rbx
|
|
8
13
|
matrix:
|
|
9
14
|
allow_failures:
|
|
10
|
-
- rvm:
|
|
11
|
-
|
|
12
|
-
- rvm:
|
|
13
|
-
script: bundle exec rake spec
|
|
15
|
+
- rvm: ruby-head
|
|
16
|
+
- rvm: rbx
|
|
17
|
+
- rvm: jruby
|
|
14
18
|
notifications:
|
|
15
19
|
flowdock:
|
|
16
20
|
secure: fSZxX5z3bHWT8aCFKBFrDDt5o3Jb6EFWcm+pAcMabpfDHc4iktWuCUlSM405798TRdKdws1A2RncQGYiQyLbqNvtLz48dvj4BxgYW7P/vg0koN+I/H2MjpZeuIQ7BRSEJIq2sAYNVya+hSil+SPEBMTngJiP6VYG0dm6fFnRkyk=
|
|
17
21
|
addons:
|
|
18
22
|
code_climate:
|
|
19
23
|
repo_token: 704eb62133d951ce460a6047a15a58e0a521aa20ec6a533fa7a37585f8a75602
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
before_script:
|
|
25
|
+
- ./install-cc-test-reporter.sh
|
|
26
|
+
- ./cc-test-reporter before-build
|
|
27
|
+
after_script:
|
|
28
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
### Security
|
|
13
13
|
|
|
14
|
+
## [0.9.0] - 2019-01-09
|
|
15
|
+
### Added
|
|
16
|
+
- Add attr_reader for `id` to class `Shipcloud::Address` to be able to get the id of a created address
|
|
17
|
+
- Add attr_reader for `id` to class `Shipcloud::Webhook` to be able to get the id of a created webhook
|
|
18
|
+
- Add attr_reader for `customs_declaration` to class `Shipcloud::Shipment` to be able to get the `customs_declaration` of a created shipment
|
|
19
|
+
|
|
14
20
|
## [0.8.0] - 2017-07-03
|
|
15
21
|
### Added
|
|
16
22
|
- Add attribute ```metadata``` to class ```Shipcloud::Shipment``` in order to transmit JSON data (#16).
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[](https://codeclimate.com/github/shipcloud/shipcloud-ruby) [](https://travis-ci.org/shipcloud/shipcloud-ruby)
|
|
1
|
+
[](https://codeclimate.com/github/shipcloud/shipcloud-ruby) [](https://travis-ci.org/shipcloud/shipcloud-ruby)
|
|
2
2
|
|
|
3
3
|
# shipcloud
|
|
4
4
|
|
data/lib/shipcloud/address.rb
CHANGED
data/lib/shipcloud/shipment.rb
CHANGED
|
@@ -5,7 +5,8 @@ module Shipcloud
|
|
|
5
5
|
include Shipcloud::Operations::All
|
|
6
6
|
|
|
7
7
|
attr_accessor :from, :to, :carrier, :package, :reference_number, :metadata
|
|
8
|
-
attr_reader :id, :created_at, :carrier_tracking_no, :tracking_url, :label_url,
|
|
8
|
+
attr_reader :id, :created_at, :carrier_tracking_no, :tracking_url, :label_url,
|
|
9
|
+
:packages, :price, :customs_declaration
|
|
9
10
|
|
|
10
11
|
def self.index_response_root
|
|
11
12
|
"#{class_name.downcase}s"
|
data/lib/shipcloud/version.rb
CHANGED
data/lib/shipcloud/webhook.rb
CHANGED
data/shipcloud.gemspec
CHANGED
|
@@ -21,11 +21,10 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
|
|
22
22
|
spec.required_ruby_version = ">= 2.0"
|
|
23
23
|
|
|
24
|
-
spec.add_runtime_dependency "json", "
|
|
25
|
-
spec.add_development_dependency "
|
|
26
|
-
spec.add_development_dependency "
|
|
27
|
-
spec.add_development_dependency "
|
|
28
|
-
spec.add_development_dependency "webmock", "~> 1.18"
|
|
24
|
+
spec.add_runtime_dependency "json", ">= 1.8.0"
|
|
25
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.6"
|
|
27
|
+
spec.add_development_dependency "webmock", "~> 3.0"
|
|
29
28
|
spec.add_development_dependency "pry", "~> 0.10"
|
|
30
|
-
spec.add_development_dependency "
|
|
29
|
+
spec.add_development_dependency "simplecov"
|
|
31
30
|
end
|
|
@@ -40,6 +40,16 @@ describe Shipcloud::Address do
|
|
|
40
40
|
|
|
41
41
|
Shipcloud::Address.create(valid_attributes)
|
|
42
42
|
end
|
|
43
|
+
|
|
44
|
+
it "returns an address containing an id" do
|
|
45
|
+
expect(Shipcloud).to receive(:request).
|
|
46
|
+
with(:post, "addresses", valid_attributes, api_key: nil).
|
|
47
|
+
and_return(returned_address)
|
|
48
|
+
|
|
49
|
+
address = Shipcloud::Address.create(valid_attributes)
|
|
50
|
+
|
|
51
|
+
expect(address.id).to eq("1c81efb7-9b95-4dd8-92e3-cac1bca3df6f")
|
|
52
|
+
end
|
|
43
53
|
end
|
|
44
54
|
|
|
45
55
|
describe '.find' do
|
|
@@ -115,4 +125,21 @@ describe Shipcloud::Address do
|
|
|
115
125
|
]
|
|
116
126
|
)
|
|
117
127
|
end
|
|
128
|
+
|
|
129
|
+
def returned_address
|
|
130
|
+
{
|
|
131
|
+
"id" => "1c81efb7-9b95-4dd8-92e3-cac1bca3df6f",
|
|
132
|
+
"company" => "shipcloud GmbH",
|
|
133
|
+
"first_name" => "Maxi",
|
|
134
|
+
"last_name" => "Musterfrau",
|
|
135
|
+
"care_of" => "Mustermann",
|
|
136
|
+
"street" => "Musterstraße",
|
|
137
|
+
"street_no" => "123",
|
|
138
|
+
"zip_code" => "12345",
|
|
139
|
+
"city" => "Hamburg",
|
|
140
|
+
"state" => "Hamburg",
|
|
141
|
+
"country" => "DE",
|
|
142
|
+
"phone" => "040/123456789",
|
|
143
|
+
}
|
|
144
|
+
end
|
|
118
145
|
end
|
|
@@ -7,7 +7,7 @@ describe Shipcloud::Request::Connection do
|
|
|
7
7
|
|
|
8
8
|
connection.setup_https
|
|
9
9
|
|
|
10
|
-
connection.https.
|
|
10
|
+
expect(connection.https).to_not be_nil
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -15,9 +15,9 @@ describe Shipcloud::Request::Connection do
|
|
|
15
15
|
it "performs the actual request" do
|
|
16
16
|
connection = Shipcloud::Request::Connection.new(nil)
|
|
17
17
|
connection.setup_https
|
|
18
|
-
connection.
|
|
18
|
+
allow(connection).to receive(:https_request)
|
|
19
19
|
|
|
20
|
-
connection.https.
|
|
20
|
+
expect(connection.https).to receive(:request)
|
|
21
21
|
|
|
22
22
|
connection.request
|
|
23
23
|
end
|
|
@@ -27,7 +27,11 @@ describe Shipcloud::Shipment do
|
|
|
27
27
|
id: "123456",
|
|
28
28
|
name: "bar"
|
|
29
29
|
}
|
|
30
|
-
}
|
|
30
|
+
},
|
|
31
|
+
customs_declaration: {
|
|
32
|
+
id: "123456",
|
|
33
|
+
contents_type: "commercial_goods",
|
|
34
|
+
},
|
|
31
35
|
}
|
|
32
36
|
end
|
|
33
37
|
|
|
@@ -51,6 +55,9 @@ describe Shipcloud::Shipment do
|
|
|
51
55
|
expect(shipment.package[:length]).to eq 40
|
|
52
56
|
expect(shipment.package[:width]).to eq 20
|
|
53
57
|
expect(shipment.package[:height]).to eq 20
|
|
58
|
+
|
|
59
|
+
expect(shipment.customs_declaration[:id]).to eq "123456"
|
|
60
|
+
expect(shipment.customs_declaration[:contents_type]).to eq "commercial_goods"
|
|
54
61
|
end
|
|
55
62
|
|
|
56
63
|
it "initializes the metadata correctly" do
|
|
@@ -100,8 +107,9 @@ describe Shipcloud::Shipment do
|
|
|
100
107
|
end
|
|
101
108
|
|
|
102
109
|
it "doesn't raise an error" do
|
|
103
|
-
stub_request(:delete, "https://
|
|
110
|
+
stub_request(:delete, "https://api.shipcloud.io/v1/shipments/123").
|
|
104
111
|
to_return(status: 204, body: "")
|
|
112
|
+
|
|
105
113
|
expect { Shipcloud::Shipment.delete("123", api_key: "your-api-key") }.
|
|
106
114
|
to_not raise_error
|
|
107
115
|
end
|
|
@@ -141,7 +149,7 @@ describe Shipcloud::Shipment do
|
|
|
141
149
|
with(:get, "shipments", filter, api_key: nil).
|
|
142
150
|
and_return("shipments" => shipments_array)
|
|
143
151
|
|
|
144
|
-
Shipcloud::Shipment.all(filter)
|
|
152
|
+
Shipcloud::Shipment.all(filter, api_key: nil)
|
|
145
153
|
end
|
|
146
154
|
end
|
|
147
155
|
|
|
@@ -2,6 +2,7 @@ require "spec_helper"
|
|
|
2
2
|
|
|
3
3
|
describe Shipcloud::Webhook do
|
|
4
4
|
valid_attributes = {
|
|
5
|
+
id: "583cfd8b-77c7-4447-a3a0-1568bb9cc553",
|
|
5
6
|
url: "https://example.com/webhook",
|
|
6
7
|
event_types: ["shipment.tracking.delayed", "shipment.tracking.delivered"]
|
|
7
8
|
}
|
|
@@ -11,6 +12,7 @@ describe Shipcloud::Webhook do
|
|
|
11
12
|
webhook = Shipcloud::Webhook.new(valid_attributes)
|
|
12
13
|
expect(webhook.url).to eq "https://example.com/webhook"
|
|
13
14
|
expect(webhook.event_types).to eq ["shipment.tracking.delayed", "shipment.tracking.delivered"]
|
|
15
|
+
expect(webhook.id).to eq "583cfd8b-77c7-4447-a3a0-1568bb9cc553"
|
|
14
16
|
end
|
|
15
17
|
end
|
|
16
18
|
|
data/spec/shipcloud_spec.rb
CHANGED
|
@@ -16,17 +16,20 @@ describe Shipcloud do
|
|
|
16
16
|
|
|
17
17
|
it "attempts to get a url with one param" do
|
|
18
18
|
Shipcloud.request(:get, "transactions", { param_name: "param_value" })
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
expect(WebMock).to have_requested(:get, "#{api_url}/transactions?param_name=param_value")
|
|
20
21
|
end
|
|
21
22
|
|
|
22
23
|
it "attempts to get a url with more than one param" do
|
|
23
24
|
Shipcloud.request(:get, "transactions", { client: "client_id", order: "created_at_desc" })
|
|
24
|
-
|
|
25
|
+
|
|
26
|
+
expect(WebMock).
|
|
27
|
+
to have_requested(:get, "#{api_url}/transactions?client=client_id&order=created_at_desc")
|
|
25
28
|
end
|
|
26
29
|
|
|
27
30
|
it "doesn't add a question mark if no params" do
|
|
28
31
|
Shipcloud.request(:get, "transactions", {})
|
|
29
|
-
WebMock.
|
|
32
|
+
expect(WebMock).to have_requested(:get, "#{api_url}/transactions")
|
|
30
33
|
end
|
|
31
34
|
end
|
|
32
35
|
|
|
@@ -39,7 +42,11 @@ describe Shipcloud do
|
|
|
39
42
|
|
|
40
43
|
expect(WebMock).to have_requested(
|
|
41
44
|
:get,
|
|
42
|
-
"
|
|
45
|
+
"#{api_url}/transactions",
|
|
46
|
+
).with(
|
|
47
|
+
headers: {
|
|
48
|
+
"Authorization" => "Basic #{Base64.strict_encode64('123:').chomp}",
|
|
49
|
+
},
|
|
43
50
|
)
|
|
44
51
|
end
|
|
45
52
|
end
|
|
@@ -138,4 +145,8 @@ describe Shipcloud do
|
|
|
138
145
|
)
|
|
139
146
|
end
|
|
140
147
|
end
|
|
148
|
+
|
|
149
|
+
def api_url
|
|
150
|
+
"https://#{Shipcloud.configuration.api_base}/#{Shipcloud::API_VERSION}"
|
|
151
|
+
end
|
|
141
152
|
end
|
metadata
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shipcloud
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- sthollmann
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2019-01-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "~>"
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '1.8'
|
|
20
17
|
- - ">="
|
|
21
18
|
- !ruby/object:Gem::Version
|
|
22
19
|
version: 1.8.0
|
|
@@ -24,74 +21,51 @@ dependencies:
|
|
|
24
21
|
prerelease: false
|
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
23
|
requirements:
|
|
27
|
-
- - "~>"
|
|
28
|
-
- !ruby/object:Gem::Version
|
|
29
|
-
version: '1.8'
|
|
30
24
|
- - ">="
|
|
31
25
|
- !ruby/object:Gem::Version
|
|
32
26
|
version: 1.8.0
|
|
33
|
-
- !ruby/object:Gem::Dependency
|
|
34
|
-
name: bundler
|
|
35
|
-
requirement: !ruby/object:Gem::Requirement
|
|
36
|
-
requirements:
|
|
37
|
-
- - ">="
|
|
38
|
-
- !ruby/object:Gem::Version
|
|
39
|
-
version: 1.3.0
|
|
40
|
-
- - "<"
|
|
41
|
-
- !ruby/object:Gem::Version
|
|
42
|
-
version: '2.0'
|
|
43
|
-
type: :development
|
|
44
|
-
prerelease: false
|
|
45
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
46
|
-
requirements:
|
|
47
|
-
- - ">="
|
|
48
|
-
- !ruby/object:Gem::Version
|
|
49
|
-
version: 1.3.0
|
|
50
|
-
- - "<"
|
|
51
|
-
- !ruby/object:Gem::Version
|
|
52
|
-
version: '2.0'
|
|
53
27
|
- !ruby/object:Gem::Dependency
|
|
54
28
|
name: rake
|
|
55
29
|
requirement: !ruby/object:Gem::Requirement
|
|
56
30
|
requirements:
|
|
57
31
|
- - "~>"
|
|
58
32
|
- !ruby/object:Gem::Version
|
|
59
|
-
version: '
|
|
33
|
+
version: '12.0'
|
|
60
34
|
type: :development
|
|
61
35
|
prerelease: false
|
|
62
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
63
37
|
requirements:
|
|
64
38
|
- - "~>"
|
|
65
39
|
- !ruby/object:Gem::Version
|
|
66
|
-
version: '
|
|
40
|
+
version: '12.0'
|
|
67
41
|
- !ruby/object:Gem::Dependency
|
|
68
42
|
name: rspec
|
|
69
43
|
requirement: !ruby/object:Gem::Requirement
|
|
70
44
|
requirements:
|
|
71
45
|
- - "~>"
|
|
72
46
|
- !ruby/object:Gem::Version
|
|
73
|
-
version: '
|
|
47
|
+
version: '3.6'
|
|
74
48
|
type: :development
|
|
75
49
|
prerelease: false
|
|
76
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
77
51
|
requirements:
|
|
78
52
|
- - "~>"
|
|
79
53
|
- !ruby/object:Gem::Version
|
|
80
|
-
version: '
|
|
54
|
+
version: '3.6'
|
|
81
55
|
- !ruby/object:Gem::Dependency
|
|
82
56
|
name: webmock
|
|
83
57
|
requirement: !ruby/object:Gem::Requirement
|
|
84
58
|
requirements:
|
|
85
59
|
- - "~>"
|
|
86
60
|
- !ruby/object:Gem::Version
|
|
87
|
-
version: '
|
|
61
|
+
version: '3.0'
|
|
88
62
|
type: :development
|
|
89
63
|
prerelease: false
|
|
90
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
91
65
|
requirements:
|
|
92
66
|
- - "~>"
|
|
93
67
|
- !ruby/object:Gem::Version
|
|
94
|
-
version: '
|
|
68
|
+
version: '3.0'
|
|
95
69
|
- !ruby/object:Gem::Dependency
|
|
96
70
|
name: pry
|
|
97
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -107,7 +81,7 @@ dependencies:
|
|
|
107
81
|
- !ruby/object:Gem::Version
|
|
108
82
|
version: '0.10'
|
|
109
83
|
- !ruby/object:Gem::Dependency
|
|
110
|
-
name:
|
|
84
|
+
name: simplecov
|
|
111
85
|
requirement: !ruby/object:Gem::Requirement
|
|
112
86
|
requirements:
|
|
113
87
|
- - ">="
|
|
@@ -132,12 +106,14 @@ files:
|
|
|
132
106
|
- ".hound.yml"
|
|
133
107
|
- ".rspec"
|
|
134
108
|
- ".rubocop.yml"
|
|
109
|
+
- ".ruby-version"
|
|
135
110
|
- ".travis.yml"
|
|
136
111
|
- CHANGELOG.md
|
|
137
112
|
- Gemfile
|
|
138
113
|
- LICENSE.txt
|
|
139
114
|
- README.md
|
|
140
115
|
- Rakefile
|
|
116
|
+
- install-cc-test-reporter.sh
|
|
141
117
|
- lib/shipcloud.rb
|
|
142
118
|
- lib/shipcloud/address.rb
|
|
143
119
|
- lib/shipcloud/base.rb
|
|
@@ -191,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
191
167
|
version: '0'
|
|
192
168
|
requirements: []
|
|
193
169
|
rubyforge_project:
|
|
194
|
-
rubygems_version: 2.6
|
|
170
|
+
rubygems_version: 2.7.6
|
|
195
171
|
signing_key:
|
|
196
172
|
specification_version: 4
|
|
197
173
|
summary: A wrapper for the shipcloud API
|