postnord 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +14 -2
- data/README.md +0 -1
- data/lib/postnord.rb +1 -2
- data/lib/postnord/client.rb +1 -4
- data/lib/postnord/response.rb +4 -12
- data/lib/postnord/version.rb +1 -1
- data/postnord.gemspec +5 -3
- metadata +43 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2550e4ba78facd2f6fb1413507ef6b1221a78d2c38051f66236567bd69d66b97
|
4
|
+
data.tar.gz: 2a5fa455c2103198b8d0eea794f882eca63709c681c317213ef4942390826d87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6fc2b5141a707845ae7f6a515afaa033e8134408487df2b5844e426884010080c55a2a7b3488e285143b32f670ab1be5dd05271c7a754340a5f23e9c947afd0
|
7
|
+
data.tar.gz: bc1aad93c2ac14c0991e1e273fdd20d177739963a206f282acdcb715678a1561071415ca85852e2e32c46bc6e63113926c55bed628d0cf2aa83231ba3c8d7c5c
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
postnord
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.7.0
|
data/.travis.yml
CHANGED
@@ -1,5 +1,17 @@
|
|
1
|
+
env:
|
2
|
+
global:
|
3
|
+
secure: Afcpwug4eQV5t+A/q19BM3Dm9i6K4J/7NaFEUy+Vo+YMXnYsAFl0DE0eJccW8SrLBa3j5tBbQE9Bl0Uup7K71gf2EjN5TKT0iOW59l4/g6Oe7mPESopVn+738nIyqH0Vk3G389K4YsgwbChHcxmUdAeLnKPX6H8nMk7LkZZVDhZPwp0xVgofmnj85b+mLQ4roNJr0CmpeO4t/hNXc6+IDg/lnH+rYrXb/hFdugv92SQCWqE486xuMa3Pmfjp+/wfYHcxSu/0DpPlsS/pBHtijc3ej41kMvCLXr08OWCDxdVqmpFjswNM6KL5Zl8FQmsjE7GreREXoY7S1KmtFefYS5bfmwbRK4LW6RmzqOO5pcIunRjTC7c6sABM8R7heSz3P48Nqdy8W8ikWKptwolIbTxVoqLoYUlNBoCcGIElSeRXTUQrDwFzMzSsbIZPFHv/Z9rXv3ES0QjXDfKHINqwK2eqJBnbbZOntsIIK/gnWS5cn8B/uWtTi6bODkEkSASLDw6NMI5srZb8Qp74cNufBm7TuzcWVaNork0PANtqnD5uKbu4KB+qghqUUs+pukBniHJScXC1+DGBEKHcGaAusOkGa5Zz1bwSvBjsgUPny/rUAT7sB5139ukET+k64DfYDhHX5eWajtwvAnlmICvFS2xpBjawaB3yQrqn6H8R8vQ=
|
1
4
|
sudo: false
|
2
5
|
language: ruby
|
6
|
+
cache: bundler
|
3
7
|
rvm:
|
4
|
-
|
5
|
-
|
8
|
+
- 2.5.1
|
9
|
+
- 2.7.0
|
10
|
+
before_script:
|
11
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
12
|
+
- chmod +x ./cc-test-reporter
|
13
|
+
- ./cc-test-reporter before-build
|
14
|
+
script:
|
15
|
+
- bundle exec rake
|
16
|
+
after_script:
|
17
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/README.md
CHANGED
@@ -37,7 +37,6 @@ How to fetch a package with the test identifier from [developer documentation](h
|
|
37
37
|
```ruby
|
38
38
|
> response = Postnord.find_by_identifier('84971563697SE')
|
39
39
|
> response.code # => 200
|
40
|
-
> response.status # => OK
|
41
40
|
> response.data # => {"TrackingInformationResponse"=>{"shipments"=>[]}}
|
42
41
|
```
|
43
42
|
|
data/lib/postnord.rb
CHANGED
data/lib/postnord/client.rb
CHANGED
@@ -18,11 +18,8 @@ module Postnord
|
|
18
18
|
)
|
19
19
|
|
20
20
|
uri.query = URI.encode_www_form(params)
|
21
|
-
req = Net::HTTP::Get.new(uri)
|
22
21
|
|
23
|
-
res =
|
24
|
-
http.request(req)
|
25
|
-
end
|
22
|
+
res = Faraday.get(uri)
|
26
23
|
|
27
24
|
Response.new(res)
|
28
25
|
end
|
data/lib/postnord/response.rb
CHANGED
@@ -1,17 +1,10 @@
|
|
1
1
|
module Postnord
|
2
2
|
class Response
|
3
|
+
attr_reader :code
|
4
|
+
|
3
5
|
def initialize(data)
|
4
6
|
@data = data
|
5
|
-
@code = data.
|
6
|
-
@status = data.msg
|
7
|
-
end
|
8
|
-
|
9
|
-
def code
|
10
|
-
@data.code
|
11
|
-
end
|
12
|
-
|
13
|
-
def status
|
14
|
-
@data.status
|
7
|
+
@code = data.status
|
15
8
|
end
|
16
9
|
|
17
10
|
def data
|
@@ -22,8 +15,7 @@ module Postnord
|
|
22
15
|
|
23
16
|
def to_h
|
24
17
|
{
|
25
|
-
code:
|
26
|
-
status: @status,
|
18
|
+
code: code,
|
27
19
|
data: data,
|
28
20
|
}
|
29
21
|
end
|
data/lib/postnord/version.rb
CHANGED
data/postnord.gemspec
CHANGED
@@ -18,8 +18,10 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.
|
22
|
-
spec.add_development_dependency "
|
21
|
+
spec.add_dependency 'faraday'
|
22
|
+
spec.add_development_dependency "webmock"
|
23
|
+
spec.add_development_dependency "bundler"
|
24
|
+
spec.add_development_dependency "rake", ">= 10.0"
|
23
25
|
spec.add_development_dependency "rspec", "~> 3.0"
|
24
|
-
spec.add_development_dependency "simplecov"
|
26
|
+
spec.add_development_dependency "simplecov", "~> 0.17.1"
|
25
27
|
end
|
metadata
CHANGED
@@ -1,41 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postnord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Åhman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: webmock
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: bundler
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
16
44
|
requirements:
|
17
|
-
- - "
|
45
|
+
- - ">="
|
18
46
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
47
|
+
version: '0'
|
20
48
|
type: :development
|
21
49
|
prerelease: false
|
22
50
|
version_requirements: !ruby/object:Gem::Requirement
|
23
51
|
requirements:
|
24
|
-
- - "
|
52
|
+
- - ">="
|
25
53
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
54
|
+
version: '0'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: rake
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
30
58
|
requirements:
|
31
|
-
- - "
|
59
|
+
- - ">="
|
32
60
|
- !ruby/object:Gem::Version
|
33
61
|
version: '10.0'
|
34
62
|
type: :development
|
35
63
|
prerelease: false
|
36
64
|
version_requirements: !ruby/object:Gem::Requirement
|
37
65
|
requirements:
|
38
|
-
- - "
|
66
|
+
- - ">="
|
39
67
|
- !ruby/object:Gem::Version
|
40
68
|
version: '10.0'
|
41
69
|
- !ruby/object:Gem::Dependency
|
@@ -56,16 +84,16 @@ dependencies:
|
|
56
84
|
name: simplecov
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
58
86
|
requirements:
|
59
|
-
- - "
|
87
|
+
- - "~>"
|
60
88
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
89
|
+
version: 0.17.1
|
62
90
|
type: :development
|
63
91
|
prerelease: false
|
64
92
|
version_requirements: !ruby/object:Gem::Requirement
|
65
93
|
requirements:
|
66
|
-
- - "
|
94
|
+
- - "~>"
|
67
95
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
96
|
+
version: 0.17.1
|
69
97
|
description:
|
70
98
|
email:
|
71
99
|
- stefan.ahman@apoex.se
|
@@ -75,6 +103,8 @@ extra_rdoc_files: []
|
|
75
103
|
files:
|
76
104
|
- ".gitignore"
|
77
105
|
- ".rspec"
|
106
|
+
- ".ruby-gemset"
|
107
|
+
- ".ruby-version"
|
78
108
|
- ".simplecov"
|
79
109
|
- ".travis.yml"
|
80
110
|
- Gemfile
|
@@ -112,8 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
142
|
- !ruby/object:Gem::Version
|
113
143
|
version: '0'
|
114
144
|
requirements: []
|
115
|
-
|
116
|
-
rubygems_version: 2.5.1
|
145
|
+
rubygems_version: 3.1.2
|
117
146
|
signing_key:
|
118
147
|
specification_version: 4
|
119
148
|
summary: A gem for Postnord's API
|