packlink_lite 0.2.0 → 0.5.0

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
- SHA1:
3
- metadata.gz: 7ccaab6fdc49a94edc939dd75fb129a75d188a6e
4
- data.tar.gz: effae85c177be32d29907f89948d1859a06b3f36
2
+ SHA256:
3
+ metadata.gz: b0a8ac0008b13809fbfc4244b9f544736b62875d561e477e10f35590451a8309
4
+ data.tar.gz: 5883d2a574d8b23599c48e276903fe9634b1fdd27767c80da10218314db7b134
5
5
  SHA512:
6
- metadata.gz: 262a7e460c8fb55bd3e23273e5978525e780d83d0544910ff7e4e277288f09f5f39d966717f9d8f5bf3306ad062cead28bec0ab60df7a076b4326a7c506f5cbb
7
- data.tar.gz: 108d0de88dfaf74dbeff54098c595218f8b67d6ab0ee3d7a186a9e0f7dd400030604d80d02e58c05e2392b5e84cdfebafdaca77df14e441663517434ad3a96ba
6
+ metadata.gz: f98d79dc03af172268ac3443edc92a6e5b46de487d37fcd8bdba300db194fcfd69bb737013f4f3b96c70146ee350b0e52f3570883ca6b45606e8d2978f8bc61b
7
+ data.tar.gz: db22020ae99136941f7613ef2acef4b804b1f351fbae474dc195ba8aa84c58821f30cbcafecec7fd3de60d0de899dfc913ab03aeb4b9deb05dd45d7476f06de4
data/.travis.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.3
4
- - 2.2.3
5
3
  - 2.3.0
6
- before_install: gem install bundler -v 1.11.2
4
+ - 2.4.1
5
+ - 2.6.3
6
+ before_install: gem install bundler -v 1.17.3
data/lib/packlink_lite.rb CHANGED
@@ -30,11 +30,11 @@ module PacklinkLite
30
30
  config.testing? ? SANDBOX_URL : PRODUCTION_URL
31
31
  end
32
32
 
33
- def change_shipment_callback_url(url)
34
- client.post('shipments/callback', { url: url }, parse_response: false)
33
+ def change_shipment_callback_url(url, options = {})
34
+ client.post('shipments/callback', { url: url }, options.merge(parse_response: false))
35
35
  end
36
36
 
37
- def change_tracking_callback_url(url)
38
- client.post('shipments/tracking_callback', { url: url }, parse_response: false)
37
+ def change_tracking_callback_url(url, options = {})
38
+ client.post('shipments/tracking_callback', { url: url }, options.merge(parse_response: false))
39
39
  end
40
40
  end
@@ -29,13 +29,19 @@ module PacklinkLite
29
29
  def with_error_handling
30
30
  yield
31
31
  rescue Faraday::ClientError => e
32
- message = extract_error_message(e.response[:body]) || e.message
32
+ message = extract_error_message(e.response[:body]) if e.response
33
+ message ||= e.message
34
+
33
35
  raise(Error, message)
34
36
  end
35
37
 
36
38
  def connection(api_key)
39
+ token = api_key || PacklinkLite.config.api_key
40
+
41
+ raise(Error, 'API key is not set') unless token
42
+
37
43
  @connection ||= build_connection
38
- @connection.headers['Authorization'] = api_key || PacklinkLite.config.api_key
44
+ @connection.headers['Authorization'] = token
39
45
  @connection
40
46
  end
41
47
 
@@ -44,7 +50,6 @@ module PacklinkLite
44
50
  builder.options[:timeout] = config.timeout
45
51
  builder.options[:open_timeout] = config.timeout
46
52
 
47
- builder.request :retry
48
53
  builder.request :json
49
54
 
50
55
  builder.headers['Accept'] = 'application/json'
@@ -4,7 +4,7 @@ module PacklinkLite
4
4
  alias_method :testing?, :testing
5
5
 
6
6
  def timeout
7
- @timeout || 60
7
+ @timeout || 30
8
8
  end
9
9
  end
10
10
  end
@@ -1,3 +1,3 @@
1
1
  module PacklinkLite
2
- VERSION = '0.2.0'
2
+ VERSION = '0.5.0'
3
3
  end
@@ -19,12 +19,12 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ['lib']
21
21
 
22
- spec.add_dependency 'faraday', '~> 0.9'
23
- spec.add_dependency 'faraday_middleware', '~> 0.10'
22
+ spec.add_dependency 'faraday', '~> 1.0'
23
+ spec.add_dependency 'faraday_middleware', '~> 1.0'
24
24
 
25
- spec.add_development_dependency 'bundler', '~> 1.11'
26
- spec.add_development_dependency 'rake', '~> 10.0'
27
- spec.add_development_dependency 'rspec', '~> 3.0'
28
- spec.add_development_dependency 'dotenv', '~> 2.1'
29
- spec.add_development_dependency 'webmock', '~> 1.24'
25
+ spec.add_development_dependency 'bundler'
26
+ spec.add_development_dependency 'rake'
27
+ spec.add_development_dependency 'rspec'
28
+ spec.add_development_dependency 'dotenv'
29
+ spec.add_development_dependency 'webmock'
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packlink_lite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laurynas Butkus
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-10 00:00:00.000000000 Z
11
+ date: 2021-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,98 +16,98 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.9'
19
+ version: '1.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: '0.9'
26
+ version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday_middleware
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.10'
33
+ version: '1.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.10'
40
+ version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.11'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.11'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '3.0'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '3.0'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: dotenv
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '2.1'
89
+ version: '0'
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: '2.1'
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: webmock
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '1.24'
103
+ version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '1.24'
110
+ version: '0'
111
111
  description: Client to access packlink.com shipping API
112
112
  email:
113
113
  - laurynas.butkus@gmail.com
@@ -154,8 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  - !ruby/object:Gem::Version
155
155
  version: '0'
156
156
  requirements: []
157
- rubyforge_project:
158
- rubygems_version: 2.4.5
157
+ rubygems_version: 3.0.3
159
158
  signing_key:
160
159
  specification_version: 4
161
160
  summary: Packlink.com API client