pactas_itero 0.6.0 → 0.7.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.
@@ -1,14 +1,12 @@
1
- require 'spec_helper'
2
- require 'json'
1
+ require "spec_helper"
2
+ require "json"
3
3
 
4
4
  describe PactasItero::Client do
5
-
6
5
  before do
7
6
  PactasItero.reset!
8
7
  end
9
8
 
10
9
  describe "module configuration" do
11
-
12
10
  before do
13
11
  PactasItero.configure do |config|
14
12
  PactasItero::Configurable.keys.each do |key|
@@ -26,12 +24,11 @@ describe PactasItero::Client do
26
24
  end
27
25
 
28
26
  describe "with class level configuration" do
29
-
30
27
  before do
31
28
  @opts = {
32
- #connection_options: {ssl: {verify: false}},
33
- client_id: "the_client_id",
34
- client_secret: "the_client_secret"
29
+ # connection_options: {ssl: {verify: false}},
30
+ client_id: "the_client_id",
31
+ client_secret: "the_client_secret",
35
32
  }
36
33
  end
37
34
 
@@ -60,7 +57,7 @@ describe PactasItero::Client do
60
57
 
61
58
  describe ".get" do
62
59
  it "requests the given resource using get" do
63
- client = PactasItero::Client.new(bearer_token: 'bt')
60
+ client = PactasItero::Client.new(bearer_token: "bt")
64
61
  request = stub_get("/something?foo=bar")
65
62
 
66
63
  client.get "/something", foo: "bar"
@@ -69,7 +66,7 @@ describe PactasItero::Client do
69
66
  end
70
67
 
71
68
  it "passes along request headers" do
72
- client = PactasItero::Client.new(bearer_token: 'bt')
69
+ client = PactasItero::Client.new(bearer_token: "bt")
73
70
  request = stub_get("/").
74
71
  with(query: { foo: "bar" }, headers: { accept: "text/plain" })
75
72
  client.get "/", foo: "bar", accept: "text/plain"
@@ -80,7 +77,7 @@ describe PactasItero::Client do
80
77
 
81
78
  describe ".head" do
82
79
  it "requests the given resource using head" do
83
- client = PactasItero::Client.new(bearer_token: 'bt')
80
+ client = PactasItero::Client.new(bearer_token: "bt")
84
81
  request = stub_head("/something?foo=bar")
85
82
 
86
83
  client.head "/something", foo: "bar"
@@ -89,7 +86,7 @@ describe PactasItero::Client do
89
86
  end
90
87
 
91
88
  it "passes along request headers" do
92
- client = PactasItero::Client.new(bearer_token: 'bt')
89
+ client = PactasItero::Client.new(bearer_token: "bt")
93
90
  request = stub_head("/").
94
91
  with(query: { foo: "bar" }, headers: { accept: "text/plain" })
95
92
 
@@ -101,7 +98,7 @@ describe PactasItero::Client do
101
98
 
102
99
  describe ".post" do
103
100
  it "requests the given resource using post" do
104
- client = PactasItero::Client.new(bearer_token: 'bt')
101
+ client = PactasItero::Client.new(bearer_token: "bt")
105
102
  request = stub_post("/something").
106
103
  with(body: { foo: "bar" }.to_json)
107
104
 
@@ -111,7 +108,7 @@ describe PactasItero::Client do
111
108
  end
112
109
 
113
110
  it "passes along request headers" do
114
- client = PactasItero::Client.new(bearer_token: 'bt')
111
+ client = PactasItero::Client.new(bearer_token: "bt")
115
112
  headers = { "X-Foo" => "bar" }
116
113
  request = stub_post("/").
117
114
  with(body: { foo: "bar" }.to_json, headers: headers)
@@ -124,7 +121,7 @@ describe PactasItero::Client do
124
121
 
125
122
  describe ".put" do
126
123
  it "requests the given resource using put" do
127
- client = PactasItero::Client.new(bearer_token: 'bt')
124
+ client = PactasItero::Client.new(bearer_token: "bt")
128
125
  request = stub_put("/something").
129
126
  with(body: { foo: "bar" }.to_json)
130
127
 
@@ -134,7 +131,7 @@ describe PactasItero::Client do
134
131
  end
135
132
 
136
133
  it "passes along request headers" do
137
- client = PactasItero::Client.new(bearer_token: 'bt')
134
+ client = PactasItero::Client.new(bearer_token: "bt")
138
135
  headers = { "X-Foo" => "bar" }
139
136
  request = stub_put("/").
140
137
  with(body: { foo: "bar" }.to_json, headers: headers)
@@ -147,7 +144,7 @@ describe PactasItero::Client do
147
144
 
148
145
  describe ".patch" do
149
146
  it "requests the given resource using patch" do
150
- client = PactasItero::Client.new(bearer_token: 'bt')
147
+ client = PactasItero::Client.new(bearer_token: "bt")
151
148
  request = stub_patch("/something").
152
149
  with(body: { foo: "bar" }.to_json)
153
150
 
@@ -157,7 +154,7 @@ describe PactasItero::Client do
157
154
  end
158
155
 
159
156
  it "passes along request headers" do
160
- client = PactasItero::Client.new(bearer_token: 'bt')
157
+ client = PactasItero::Client.new(bearer_token: "bt")
161
158
  headers = { "X-Foo" => "bar" }
162
159
  request = stub_patch("/").
163
160
  with(body: { foo: "bar" }.to_json, headers: headers)
@@ -170,7 +167,7 @@ describe PactasItero::Client do
170
167
 
171
168
  describe ".delete" do
172
169
  it "requests the given resource using delete" do
173
- client = PactasItero::Client.new(bearer_token: 'bt')
170
+ client = PactasItero::Client.new(bearer_token: "bt")
174
171
  request = stub_delete("/something")
175
172
 
176
173
  client.delete "/something"
@@ -179,7 +176,7 @@ describe PactasItero::Client do
179
176
  end
180
177
 
181
178
  it "passes along request headers" do
182
- client = PactasItero::Client.new(bearer_token: 'bt')
179
+ client = PactasItero::Client.new(bearer_token: "bt")
183
180
  headers = { "X-Foo" => "bar" }
184
181
  request = stub_delete("/").with(headers: headers)
185
182
 
@@ -190,8 +187,7 @@ describe PactasItero::Client do
190
187
  end
191
188
 
192
189
  describe "when making requests" do
193
-
194
- it 'uses the sandbox endpoint by default' do
190
+ it "uses the sandbox endpoint by default" do
195
191
  client = PactasItero::Client.new
196
192
 
197
193
  expect(client.api_endpoint).to eq "https://sandbox.billwerk.com/"
@@ -204,7 +200,7 @@ describe PactasItero::Client do
204
200
  end
205
201
 
206
202
  it "sets a default user agent" do
207
- client = PactasItero::Client.new(bearer_token: 'bt')
203
+ client = PactasItero::Client.new(bearer_token: "bt")
208
204
  request = stub_get("/").
209
205
  with(headers: { user_agent: PactasItero::Default.user_agent })
210
206
 
@@ -215,7 +211,7 @@ describe PactasItero::Client do
215
211
 
216
212
  it "accepts a custom user agent" do
217
213
  user_agent = "Mozilla/1.0 (Win3.1)"
218
- client = PactasItero::Client.new(user_agent: user_agent, bearer_token: 'bt')
214
+ client = PactasItero::Client.new(user_agent: user_agent, bearer_token: "bt")
219
215
  request = stub_get("/").with(headers: { user_agent: user_agent })
220
216
 
221
217
  client.get "/"
@@ -223,8 +219,8 @@ describe PactasItero::Client do
223
219
  expect(request).to have_been_made
224
220
  end
225
221
 
226
- it 'creates the correct auth headers with supplied bearer_token' do
227
- token = 'the_bearer_token'
222
+ it "creates the correct auth headers with supplied bearer_token" do
223
+ token = "the_bearer_token"
228
224
  request = stub_get("/").with(headers: { authorization: "Bearer #{token}" })
229
225
  client = PactasItero::Client.new(bearer_token: token)
230
226
 
@@ -233,8 +229,8 @@ describe PactasItero::Client do
233
229
  expect(request).to have_been_made
234
230
  end
235
231
 
236
- it 'creates the correct auth headers with supplied bearer_token' do
237
- token = OpenStruct.new(access_token: 'the_bearer_token')
232
+ it "creates the correct auth headers with supplied bearer_token" do
233
+ token = OpenStruct.new(access_token: "the_bearer_token")
238
234
  client = PactasItero::Client.new(bearer_token: token)
239
235
 
240
236
  request = stub_get("/").with(headers: { authorization: "Bearer #{token.access_token}" })
@@ -247,28 +243,28 @@ describe PactasItero::Client do
247
243
 
248
244
  context "error handling" do
249
245
  it "raises on 404" do
250
- client = PactasItero::Client.new(bearer_token: 'bt')
251
- stub_get('/four_oh_four').to_return(status: 404)
246
+ client = PactasItero::Client.new(bearer_token: "bt")
247
+ stub_get("/four_oh_four").to_return(status: 404)
252
248
 
253
- expect { client.get('/four_oh_four') }.to raise_error PactasItero::NotFound
249
+ expect { client.get("/four_oh_four") }.to raise_error PactasItero::NotFound
254
250
  end
255
251
 
256
252
  it "raises on 500" do
257
- client = PactasItero::Client.new(bearer_token: 'bt')
258
- stub_get('/five_oh_oh').to_return(status: 500)
253
+ client = PactasItero::Client.new(bearer_token: "bt")
254
+ stub_get("/five_oh_oh").to_return(status: 500)
259
255
 
260
- expect { client.get('/five_oh_oh') }.to raise_error PactasItero::InternalServerError
256
+ expect { client.get("/five_oh_oh") }.to raise_error PactasItero::InternalServerError
261
257
  end
262
258
 
263
259
  it "includes a message" do
264
- client = PactasItero::Client.new(bearer_token: 'bt')
265
- stub_get('/with_message').to_return(
260
+ client = PactasItero::Client.new(bearer_token: "bt")
261
+ stub_get("/with_message").to_return(
266
262
  status: 422,
267
263
  headers: { content_type: "application/json" },
268
- body: { Message: "'Something' is not a valid ObjectId. Expected a 24 digit hex string." }.to_json
264
+ body: { Message: "'Something' is not a valid ObjectId. Expected a 24 digit hex string." }.to_json,
269
265
  )
270
266
 
271
- expect { client.get('/with_message') }.to raise_error(
267
+ expect { client.get("/with_message") }.to raise_error(
272
268
  PactasItero::UnprocessableEntity,
273
269
  "GET https://sandbox.billwerk.com/with_message: " \
274
270
  "422 - 'Something' is not a valid ObjectId. Expected a 24 digit hex string.",
@@ -276,38 +272,38 @@ describe PactasItero::Client do
276
272
  end
277
273
 
278
274
  it "raises a ClientError on unknown client errors" do
279
- client = PactasItero::Client.new(bearer_token: 'bt')
280
- stub_get('/something').to_return(
275
+ client = PactasItero::Client.new(bearer_token: "bt")
276
+ stub_get("/something").to_return(
281
277
  status: 418,
282
278
  headers: { content_type: "application/json" },
283
- body: { message: "I'm a teapot" }.to_json
279
+ body: { message: "I'm a teapot" }.to_json,
284
280
  )
285
281
 
286
- expect { client.get('/something') }.to raise_error PactasItero::ClientError
282
+ expect { client.get("/something") }.to raise_error PactasItero::ClientError
287
283
  end
288
284
 
289
285
  it "raises a ServerError on unknown server errors" do
290
- client = PactasItero::Client.new(bearer_token: 'bt')
291
- stub_get('/something').to_return(
286
+ client = PactasItero::Client.new(bearer_token: "bt")
287
+ stub_get("/something").to_return(
292
288
  status: 509,
293
289
  headers: { content_type: "application/json" },
294
- body: { message: "Bandwidth exceeded" }.to_json
290
+ body: { message: "Bandwidth exceeded" }.to_json,
295
291
  )
296
292
 
297
- expect { client.get('/something') }.to raise_error PactasItero::ServerError
293
+ expect { client.get("/something") }.to raise_error PactasItero::ServerError
298
294
  end
299
295
  end
300
296
 
301
- describe '.sandbox_api_endpoint' do
302
- it 'returns url of the sandbox endpoint' do
297
+ describe ".sandbox_api_endpoint" do
298
+ it "returns url of the sandbox endpoint" do
303
299
  client = PactasItero::Client.new
304
300
 
305
301
  expect(client.sandbox_api_endpoint).to eq "https://sandbox.billwerk.com"
306
302
  end
307
303
  end
308
304
 
309
- describe '.production_api_endpoint' do
310
- it 'returns url of the sandbox endpoint' do
305
+ describe ".production_api_endpoint" do
306
+ it "returns url of the sandbox endpoint" do
311
307
  client = PactasItero::Client.new
312
308
 
313
309
  expect(client.production_api_endpoint).to eq "https://app.billwerk.com"
@@ -1,7 +1,6 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe PactasItero do
4
-
5
4
  it "sets defaults" do
6
5
  PactasItero::Configurable.keys.each do |key|
7
6
  expect(PactasItero.instance_variable_get(:"@#{key}")).to eq(PactasItero::Default.send(key))
@@ -35,5 +34,4 @@ describe PactasItero do
35
34
  end
36
35
  end
37
36
  end
38
-
39
37
  end
data/spec/spec_helper.rb CHANGED
@@ -1,20 +1,20 @@
1
- require 'simplecov'
1
+ require "simplecov"
2
2
 
3
3
  SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
4
4
  SimpleCov::Formatter::HTMLFormatter,
5
5
  )
6
6
 
7
7
  SimpleCov.start do
8
- add_filter '/spec/'
9
- add_filter '/vendor/bundle'
10
- #minimum_coverage(99.15)
8
+ add_filter "/spec/"
9
+ add_filter "/vendor/bundle"
10
+ # minimum_coverage(99.15)
11
11
  refuse_coverage_drop
12
12
  end
13
13
 
14
- require 'json'
15
- require 'pactas_itero'
16
- require 'rspec'
17
- require 'webmock/rspec'
14
+ require "json"
15
+ require "pactas_itero"
16
+ require "rspec"
17
+ require "webmock/rspec"
18
18
 
19
19
  WebMock.disable_net_connect!
20
20
 
@@ -35,7 +35,7 @@ RSpec.configure do |config|
35
35
  /bin\//,
36
36
  /vendor\/bundle\/(.*)\/gems\//,
37
37
  /spec\/spec_helper.rb/,
38
- /lib\/rspec\/(core|expectations|matchers|mocks)/
38
+ /lib\/rspec\/(core|expectations|matchers|mocks)/,
39
39
  ]
40
40
 
41
41
  config.after(:each) do
@@ -44,11 +44,11 @@ RSpec.configure do |config|
44
44
  end
45
45
 
46
46
  def fixture_path
47
- File.expand_path('../fixtures', __FILE__)
47
+ File.expand_path("fixtures", __dir__)
48
48
  end
49
49
 
50
50
  def fixture(file)
51
- File.new(fixture_path + '/' + file)
51
+ File.new(fixture_path + "/" + file)
52
52
  end
53
53
 
54
54
  def pactas_api_endpoint
@@ -56,7 +56,7 @@ def pactas_api_endpoint
56
56
  end
57
57
 
58
58
  def pactas_api_url(url)
59
- url =~ /^http/ ? url : "#{pactas_api_endpoint}#{url}"
59
+ /^http/.match?(url) ? url : "#{pactas_api_endpoint}#{url}"
60
60
  end
61
61
 
62
62
  def a_delete(path)
data/yarn-error.log ADDED
@@ -0,0 +1,43 @@
1
+ Arguments:
2
+ /Users/martenklitzke/.nvm/versions/node/v14.18.2/bin/node /opt/homebrew/Cellar/yarn/1.22.17_2/libexec/bin/yarn.js add standard-version --dev
3
+
4
+ PATH:
5
+ /Users/martenklitzke/.nvm/versions/node/v14.18.2/bin:/opt/homebrew/Cellar/zplug/2.4.2/bin:/opt/homebrew/opt/python@2/libexec/bin:./node_modules/.bin:./bin:/usr/local/share/npm/bin:/bin:/Users/martenklitzke/bin:/opt/homebrew/bin:/usr/local/sbin:/opt/homebrew/var/rbenv/shims:/opt/homebrew/var/rbenv/bin:/Users/martenklitzke/.nvm/versions/node/v14.18.2/bin:/Users/martenklitzke/go/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/usr/local/opt/android-sdk/tools:/usr/local/opt/android-sdk/platform-tools:/Users/martenklitzke/Applications/bin:/usr/local/go/bin:/Users/martenklitzke/.composer/vendor/bin
6
+
7
+ Yarn version:
8
+ 1.22.17
9
+
10
+ Node version:
11
+ 14.18.2
12
+
13
+ Platform:
14
+ darwin arm64
15
+
16
+ Trace:
17
+ SyntaxError: /Users/martenklitzke/dev/billwerk/package.json: Unexpected token
18
+ in JSON at position 112
19
+ at JSON.parse (<anonymous>)
20
+ at /opt/homebrew/Cellar/yarn/1.22.17_2/libexec/lib/cli.js:1625:59
21
+ at Generator.next (<anonymous>)
22
+ at step (/opt/homebrew/Cellar/yarn/1.22.17_2/libexec/lib/cli.js:310:30)
23
+ at /opt/homebrew/Cellar/yarn/1.22.17_2/libexec/lib/cli.js:321:13
24
+
25
+ npm manifest:
26
+ {
27
+ "name": "billwerk",
28
+ "version": "0.6.0",
29
+ "description": "Billwerk provides a client mapping for accessing
30
+ the Pactas Itero API, making it easy to post your data to, and read your
31
+ data from your Pactas account.",
32
+ "main": "index.js",
33
+ "repository": "https://github.com/shipcloud/billwerk.git",
34
+ "author": "Marten Klitzke <m.klitzke@shipcloud.io>",
35
+ "license": "MIT",
36
+ "private": true
37
+ }
38
+
39
+ yarn manifest:
40
+ No manifest
41
+
42
+ Lockfile:
43
+ No lockfile
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pactas_itero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Fröhler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-03 00:00:00.000000000 Z
11
+ date: 2022-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday_middleware
@@ -72,42 +72,42 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 3.8.0
75
+ version: 3.11.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.8.0
82
+ version: 3.11.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rubocop
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.68'
89
+ version: 1.25.1
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: '0.68'
96
+ version: 1.25.1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rubocop-performance
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '1.3'
103
+ version: 1.13.2
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.3'
110
+ version: 1.13.2
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: simplecov
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -138,10 +138,11 @@ dependencies:
138
138
  version: '3.3'
139
139
  description: |-
140
140
  pactas_itero provides a client mapping for accessing
141
- the Pactas Itero API, making it easy to post your data to, adn read your
141
+ the Pactas Itero API, making it easy to post your data to, and read your
142
142
  data from your Pactas account.
143
143
  email: simon@shipcloud.io
144
- executables: []
144
+ executables:
145
+ - setup
145
146
  extensions: []
146
147
  extra_rdoc_files: []
147
148
  files:
@@ -151,6 +152,7 @@ files:
151
152
  - LICENSE.txt
152
153
  - README.md
153
154
  - Rakefile
155
+ - bin/setup
154
156
  - lib/pactas_itero.rb
155
157
  - lib/pactas_itero/api.rb
156
158
  - lib/pactas_itero/api/contracts.rb
@@ -172,6 +174,7 @@ files:
172
174
  - spec/fixtures/commit_order_response.json
173
175
  - spec/fixtures/contract.json
174
176
  - spec/fixtures/contract_cancellation_preview_response.json
177
+ - spec/fixtures/contract_changes.json
175
178
  - spec/fixtures/contract_termination_response.json
176
179
  - spec/fixtures/contracts.json
177
180
  - spec/fixtures/create_order_response.json
@@ -195,6 +198,7 @@ files:
195
198
  - spec/pactas_itero/client_spec.rb
196
199
  - spec/pactas_itero_spec.rb
197
200
  - spec/spec_helper.rb
201
+ - yarn-error.log
198
202
  homepage: https://github.com/webionate/pactas_itero
199
203
  licenses:
200
204
  - MIT
@@ -207,14 +211,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
207
211
  requirements:
208
212
  - - ">="
209
213
  - !ruby/object:Gem::Version
210
- version: '2.0'
214
+ version: '2.6'
211
215
  required_rubygems_version: !ruby/object:Gem::Requirement
212
216
  requirements:
213
217
  - - ">="
214
218
  - !ruby/object:Gem::Version
215
219
  version: '0'
216
220
  requirements: []
217
- rubygems_version: 3.1.4
221
+ rubygems_version: 3.1.6
218
222
  signing_key:
219
223
  specification_version: 4
220
224
  summary: pactas_itero provides a client mapping for accessing the Pactas Itero API.
@@ -223,6 +227,7 @@ test_files:
223
227
  - spec/fixtures/commit_order_response.json
224
228
  - spec/fixtures/contract.json
225
229
  - spec/fixtures/contract_cancellation_preview_response.json
230
+ - spec/fixtures/contract_changes.json
226
231
  - spec/fixtures/contract_termination_response.json
227
232
  - spec/fixtures/contracts.json
228
233
  - spec/fixtures/create_order_response.json