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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +60 -40
- data/README.md +3 -1
- data/Rakefile +4 -4
- data/bin/setup +7 -0
- data/lib/pactas_itero/api/contracts.rb +5 -0
- data/lib/pactas_itero/api/invoices.rb +1 -2
- data/lib/pactas_itero/api/oauth.rb +2 -3
- data/lib/pactas_itero/api/rated_items.rb +1 -1
- data/lib/pactas_itero/api.rb +7 -7
- data/lib/pactas_itero/client.rb +26 -22
- data/lib/pactas_itero/configurable.rb +5 -6
- data/lib/pactas_itero/default.rb +11 -14
- data/lib/pactas_itero/error.rb +12 -15
- data/lib/pactas_itero/ext/hash/camelize_keys.rb +7 -8
- data/lib/pactas_itero/response/raise_error.rb +2 -4
- data/lib/pactas_itero/version.rb +1 -1
- data/lib/pactas_itero.rb +2 -2
- data/pactas_itero.gemspec +18 -18
- data/spec/fixtures/contract_changes.json +22 -0
- data/spec/pactas_itero/api/contracts_spec.rb +85 -57
- data/spec/pactas_itero/api/customers_spec.rb +101 -99
- data/spec/pactas_itero/api/invoices_spec.rb +55 -55
- data/spec/pactas_itero/api/orders_spec.rb +42 -42
- data/spec/pactas_itero/api/rated_items_spec.rb +42 -42
- data/spec/pactas_itero/client_spec.rb +46 -50
- data/spec/pactas_itero_spec.rb +1 -3
- data/spec/spec_helper.rb +12 -12
- data/yarn-error.log +43 -0
- metadata +17 -12
data/pactas_itero.gemspec
CHANGED
@@ -1,37 +1,37 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path("lib", __dir__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require "pactas_itero/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = "pactas_itero"
|
8
8
|
spec.version = PactasItero::VERSION
|
9
|
-
spec.authors = [
|
9
|
+
spec.authors = ["Simon Fröhler"]
|
10
10
|
spec.email = "simon@shipcloud.io"
|
11
|
-
spec.summary =
|
12
|
-
the Pactas Itero API.
|
13
|
-
spec.description =
|
14
|
-
the Pactas Itero API, making it easy to post your data to,
|
15
|
-
data from your Pactas account.
|
16
|
-
spec.homepage =
|
17
|
-
spec.license =
|
11
|
+
spec.summary = 'pactas_itero provides a client mapping for accessing
|
12
|
+
the Pactas Itero API.'
|
13
|
+
spec.description = 'pactas_itero provides a client mapping for accessing
|
14
|
+
the Pactas Itero API, making it easy to post your data to, and read your
|
15
|
+
data from your Pactas account.'
|
16
|
+
spec.homepage = "https://github.com/webionate/pactas_itero"
|
17
|
+
spec.license = "MIT"
|
18
18
|
|
19
19
|
spec.files = Dir["lib/**/*.rb"] + Dir["bin/*"]
|
20
20
|
spec.files += Dir["[A-Z]*"] + Dir["spec/**/*"]
|
21
21
|
spec.test_files = spec.files.grep(%r{^spec/})
|
22
22
|
spec.executables = spec.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
23
|
-
spec.require_paths = [
|
23
|
+
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
-
spec.required_ruby_version = ">= 2.
|
25
|
+
spec.required_ruby_version = ">= 2.6"
|
26
26
|
|
27
27
|
spec.add_dependency("faraday_middleware", ">= 1.0")
|
28
28
|
spec.add_dependency("rash_alt")
|
29
29
|
|
30
|
-
spec.add_development_dependency
|
31
|
-
spec.add_development_dependency
|
32
|
-
spec.add_development_dependency "rspec",
|
33
|
-
spec.add_development_dependency("rubocop",
|
34
|
-
spec.add_development_dependency("rubocop-performance", "~> 1.
|
30
|
+
spec.add_development_dependency "bundler"
|
31
|
+
spec.add_development_dependency "rake"
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.11.0"
|
33
|
+
spec.add_development_dependency("rubocop", "~> 1.25.1")
|
34
|
+
spec.add_development_dependency("rubocop-performance", "~> 1.13.2")
|
35
35
|
spec.add_development_dependency("simplecov", "~> 0.16.1")
|
36
36
|
spec.add_development_dependency("webmock", "~> 3.3")
|
37
37
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": "620a22082b2290ae0d175bfa",
|
4
|
+
"type": "Upgrade",
|
5
|
+
"timestamp": "2022-02-14T08:34:00.0938297Z",
|
6
|
+
"orderId": "620a22082b2290ae0d175bfc",
|
7
|
+
"contractId": "620a22082b2290ae0d175bf8",
|
8
|
+
"changeDate": "2022-03-14T09:34:00.0938301Z",
|
9
|
+
"newPlanVariantId": "620a22082b2290ae0d175bfb",
|
10
|
+
"newPlanId": "620a22082b2290ae0d175bf9"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"id": "620a22082b2290ae0d175bfd",
|
14
|
+
"type": "Signup",
|
15
|
+
"timestamp": "2022-02-13T09:34:00.0938319Z",
|
16
|
+
"orderId": "620a22082b2290ae0d175bff",
|
17
|
+
"contractId": "620a22082b2290ae0d175bf8",
|
18
|
+
"changeDate": "2022-02-14T09:34:00.0938319Z",
|
19
|
+
"newPlanVariantId": "620a22082b2290ae0d175bfe",
|
20
|
+
"newPlanId": "620a22082b2290ae0d175bf9"
|
21
|
+
}
|
22
|
+
]
|
@@ -1,55 +1,83 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe PactasItero::Api::Customers do
|
4
|
-
describe
|
5
|
-
it
|
6
|
-
client = PactasItero::Client.new(bearer_token:
|
7
|
-
request = stub_get(
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
4
|
+
describe ".customer_contracts" do
|
5
|
+
it "requests the correct resource" do
|
6
|
+
client = PactasItero::Client.new(bearer_token: "bt")
|
7
|
+
request = stub_get("/api/v1/customers/535783241d8dd00fa0db6b2a/contracts").
|
8
|
+
to_return(
|
9
|
+
body: fixture("contracts.json"),
|
10
|
+
headers: { content_type: "application/json; charset=utf-8" },
|
11
|
+
)
|
12
12
|
|
13
|
-
client.customer_contracts(
|
13
|
+
client.customer_contracts("535783241d8dd00fa0db6b2a")
|
14
14
|
|
15
15
|
expect(request).to have_been_made
|
16
16
|
end
|
17
17
|
|
18
|
-
it
|
19
|
-
client = PactasItero::Client.new(bearer_token:
|
20
|
-
request = stub_get(
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
it "returns an array of contracts" do
|
19
|
+
client = PactasItero::Client.new(bearer_token: "bt")
|
20
|
+
request = stub_get("/api/v1/customers/535783241d8dd00fa0db6b2a/contracts").
|
21
|
+
to_return(
|
22
|
+
body: fixture("contracts.json"),
|
23
|
+
headers: { content_type: "application/json; charset=utf-8" },
|
24
|
+
)
|
25
25
|
|
26
|
-
contracts = client.customer_contracts(
|
26
|
+
contracts = client.customer_contracts("535783241d8dd00fa0db6b2a")
|
27
27
|
|
28
28
|
expect(contracts).to be_a Array
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
describe
|
33
|
-
it
|
34
|
-
client = PactasItero::Client.new(bearer_token:
|
35
|
-
request = stub_get(
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
32
|
+
describe ".contract_changes" do
|
33
|
+
it "requests the correct resource" do
|
34
|
+
client = PactasItero::Client.new(bearer_token: "bt")
|
35
|
+
request = stub_get("/api/v1/contractChanges?contractId=5357bc4f1d8dd00fa0db6c31").
|
36
|
+
to_return(
|
37
|
+
body: fixture("contract_changes.json"),
|
38
|
+
headers: { content_type: "application/json; charset=utf-8" },
|
39
|
+
)
|
40
|
+
|
41
|
+
client.contract_changes("5357bc4f1d8dd00fa0db6c31")
|
42
|
+
|
43
|
+
expect(request).to have_been_made
|
44
|
+
end
|
45
|
+
|
46
|
+
it "returns an array of contract changes" do
|
47
|
+
client = PactasItero::Client.new(bearer_token: "bt")
|
48
|
+
stub_get("/api/v1/contractChanges?contractId=5357bc4f1d8dd00fa0db6c31").
|
49
|
+
to_return(
|
50
|
+
body: fixture("contract_changes.json"),
|
51
|
+
headers: { content_type: "application/json; charset=utf-8" },
|
52
|
+
)
|
53
|
+
|
54
|
+
contract_changes = client.contract_changes("5357bc4f1d8dd00fa0db6c31")
|
55
|
+
|
56
|
+
expect(contract_changes).to be_a Array
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe ".contracts" do
|
61
|
+
it "requests the correct resource" do
|
62
|
+
client = PactasItero::Client.new(bearer_token: "bt")
|
63
|
+
request = stub_get("/api/v1/contracts").
|
64
|
+
to_return(
|
65
|
+
body: fixture("contracts.json"),
|
66
|
+
headers: { content_type: "application/json; charset=utf-8" },
|
67
|
+
)
|
40
68
|
|
41
69
|
client.contracts
|
42
70
|
|
43
71
|
expect(request).to have_been_made
|
44
72
|
end
|
45
73
|
|
46
|
-
it
|
47
|
-
client = PactasItero::Client.new(bearer_token:
|
48
|
-
request = stub_get(
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
74
|
+
it "returns an array of contracts" do
|
75
|
+
client = PactasItero::Client.new(bearer_token: "bt")
|
76
|
+
request = stub_get("/api/v1/contracts").
|
77
|
+
to_return(
|
78
|
+
body: fixture("contracts.json"),
|
79
|
+
headers: { content_type: "application/json; charset=utf-8" },
|
80
|
+
)
|
53
81
|
|
54
82
|
contracts = client.contracts
|
55
83
|
|
@@ -62,7 +90,7 @@ describe PactasItero::Api::Customers do
|
|
62
90
|
client = PactasItero::Client.new(bearer_token: "bt")
|
63
91
|
request = stub_get("/api/v1/contracts/some_contract_id/cancellationPreview").to_return(
|
64
92
|
body: fixture("contract_cancellation_preview_response.json"),
|
65
|
-
headers: { content_type: "application/json; charset=utf-8" }
|
93
|
+
headers: { content_type: "application/json; charset=utf-8" },
|
66
94
|
)
|
67
95
|
|
68
96
|
client.contract_cancellation_preview("some_contract_id")
|
@@ -70,47 +98,47 @@ describe PactasItero::Api::Customers do
|
|
70
98
|
expect(request).to have_been_made
|
71
99
|
end
|
72
100
|
|
73
|
-
it
|
74
|
-
client = PactasItero::Client.new(bearer_token:
|
101
|
+
it "returns the next possible cancellation date" do
|
102
|
+
client = PactasItero::Client.new(bearer_token: "bt")
|
75
103
|
request = stub_get("/api/v1/contracts/some_contract_id/cancellationPreview").to_return(
|
76
104
|
body: fixture("contract_cancellation_preview_response.json"),
|
77
|
-
headers: { content_type: "application/json; charset=utf-8" }
|
105
|
+
headers: { content_type: "application/json; charset=utf-8" },
|
78
106
|
)
|
79
107
|
|
80
108
|
contract_cancellation_preview = client.contract_cancellation_preview("some_contract_id")
|
81
109
|
|
82
110
|
expect(
|
83
|
-
contract_cancellation_preview.next_possible_cancellation_date
|
111
|
+
contract_cancellation_preview.next_possible_cancellation_date,
|
84
112
|
).to eq "2015-11-15T10:02:21.2750000Z"
|
85
113
|
end
|
86
114
|
end
|
87
115
|
|
88
|
-
describe
|
89
|
-
it
|
90
|
-
client = PactasItero::Client.new(bearer_token:
|
91
|
-
request = stub_patch(
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
116
|
+
describe ".update_contract" do
|
117
|
+
it "requests the correct resource" do
|
118
|
+
client = PactasItero::Client.new(bearer_token: "bt")
|
119
|
+
request = stub_patch("/api/v1/contracts/contract-id").
|
120
|
+
with(body: { EndDate: "2014-05-23T13:12:47.0760000Z" }.to_json).
|
121
|
+
to_return(
|
122
|
+
body: fixture("contract.json"),
|
123
|
+
headers: { content_type: "application/json; charset=utf-8" },
|
124
|
+
)
|
97
125
|
|
98
|
-
client.update_contract(
|
126
|
+
client.update_contract("contract-id", { end_date: "2014-05-23T13:12:47.0760000Z" })
|
99
127
|
|
100
128
|
expect(request).to have_been_made
|
101
129
|
end
|
102
130
|
end
|
103
131
|
|
104
|
-
describe
|
105
|
-
it
|
106
|
-
client = PactasItero::Client.new(bearer_token:
|
107
|
-
request = stub_get(
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
132
|
+
describe ".contract" do
|
133
|
+
it "requests the correct resource" do
|
134
|
+
client = PactasItero::Client.new(bearer_token: "bt")
|
135
|
+
request = stub_get("/api/v1/contracts/5357bc4f1d8dd00fa0db6c31").
|
136
|
+
to_return(
|
137
|
+
body: fixture("contract.json"),
|
138
|
+
headers: { content_type: "application/json; charset=utf-8" },
|
139
|
+
)
|
112
140
|
|
113
|
-
client.contract(
|
141
|
+
client.contract("5357bc4f1d8dd00fa0db6c31")
|
114
142
|
|
115
143
|
expect(request).to have_been_made
|
116
144
|
end
|
@@ -1,30 +1,30 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe PactasItero::Api::Customers do
|
4
4
|
describe ".create_customer" do
|
5
5
|
it "requests the correct resource" do
|
6
|
-
client = PactasItero::Client.new(bearer_token:
|
6
|
+
client = PactasItero::Client.new(bearer_token: "bt")
|
7
7
|
post_data = {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
8
|
+
"Address" => {
|
9
|
+
"City" => "Example City",
|
10
|
+
"Country" => "DE",
|
11
|
+
"HouseNumber" => "42",
|
12
|
+
"PostalCode" => "12345",
|
13
|
+
"Street" => "Example Street",
|
14
|
+
},
|
15
|
+
"CompanyName" => "Example Company",
|
16
|
+
"DefaultBearerMedium" => "Email",
|
17
|
+
"EmailAddress" => "jane.doe@example.com",
|
18
|
+
"ExternalCustomerId" => "1234",
|
19
|
+
"FirstName" => "Jane",
|
20
|
+
"Language" => "de-DE",
|
21
|
+
"LastName" => "Doe",
|
22
|
+
"Locale" => "de-DE",
|
23
|
+
"VatId" => "DE123456710",
|
24
24
|
}.to_json
|
25
|
-
request = stub_post(
|
26
|
-
body: fixture(
|
27
|
-
headers: { content_type:
|
25
|
+
request = stub_post("/api/v1/customers").with(body: post_data).to_return(
|
26
|
+
body: fixture("customer.json"),
|
27
|
+
headers: { content_type: "application/json; charset=utf-8" },
|
28
28
|
)
|
29
29
|
|
30
30
|
client.create_customer(
|
@@ -33,7 +33,7 @@ describe PactasItero::Api::Customers do
|
|
33
33
|
country: "DE",
|
34
34
|
house_number: "42",
|
35
35
|
postal_code: "12345",
|
36
|
-
street: "Example Street"
|
36
|
+
street: "Example Street",
|
37
37
|
},
|
38
38
|
company_name: "Example Company",
|
39
39
|
default_bearer_medium: "Email",
|
@@ -43,35 +43,35 @@ describe PactasItero::Api::Customers do
|
|
43
43
|
language: "de-DE",
|
44
44
|
last_name: "Doe",
|
45
45
|
locale: "de-DE",
|
46
|
-
vat_id: "DE123456710"
|
46
|
+
vat_id: "DE123456710",
|
47
47
|
)
|
48
48
|
|
49
49
|
expect(request).to have_been_made
|
50
50
|
end
|
51
51
|
|
52
|
-
it
|
53
|
-
client = PactasItero::Client.new(bearer_token:
|
52
|
+
it "returns the created customer" do
|
53
|
+
client = PactasItero::Client.new(bearer_token: "bt")
|
54
54
|
post_data = {
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
55
|
+
"Address" => {
|
56
|
+
"City" => "Example City",
|
57
|
+
"Country" => "DE",
|
58
|
+
"HouseNumber" => "42",
|
59
|
+
"PostalCode" => "12345",
|
60
|
+
"Street" => "Example Street",
|
61
|
+
},
|
62
|
+
"CompanyName" => "Example Company",
|
63
|
+
"DefaultBearerMedium" => "Email",
|
64
|
+
"EmailAddress" => "jane.doe@example.com",
|
65
|
+
"ExternalCustomerId" => "1234",
|
66
|
+
"FirstName" => "Jane",
|
67
|
+
"Language" => "de-DE",
|
68
|
+
"LastName" => "Doe",
|
69
|
+
"Locale" => "de-DE",
|
70
|
+
"VatId" => "DE123456710",
|
71
71
|
}.to_json
|
72
|
-
request = stub_post(
|
73
|
-
body: fixture(
|
74
|
-
headers: { content_type:
|
72
|
+
request = stub_post("/api/v1/customers").with(body: post_data).to_return(
|
73
|
+
body: fixture("customer.json"),
|
74
|
+
headers: { content_type: "application/json; charset=utf-8" },
|
75
75
|
)
|
76
76
|
|
77
77
|
customer = client.create_customer(
|
@@ -80,7 +80,7 @@ describe PactasItero::Api::Customers do
|
|
80
80
|
country: "DE",
|
81
81
|
house_number: "42",
|
82
82
|
postal_code: "12345",
|
83
|
-
street: "Example Street"
|
83
|
+
street: "Example Street",
|
84
84
|
},
|
85
85
|
company_name: "Example Company",
|
86
86
|
default_bearer_medium: "Email",
|
@@ -90,7 +90,7 @@ describe PactasItero::Api::Customers do
|
|
90
90
|
language: "de-DE",
|
91
91
|
last_name: "Doe",
|
92
92
|
locale: "de-DE",
|
93
|
-
vat_id: "DE123456710"
|
93
|
+
vat_id: "DE123456710",
|
94
94
|
)
|
95
95
|
|
96
96
|
address = customer.address
|
@@ -101,7 +101,7 @@ describe PactasItero::Api::Customers do
|
|
101
101
|
expect(address.street).to eq "Example Street"
|
102
102
|
|
103
103
|
expect(customer.company_name).to eq "Example Company"
|
104
|
-
expect(customer.default_bearer_medium).to eq"Email"
|
104
|
+
expect(customer.default_bearer_medium).to eq "Email"
|
105
105
|
expect(customer.email_address).to eq "jane.doe@example.com"
|
106
106
|
expect(customer.external_customer_id).to eq "1234"
|
107
107
|
expect(customer.first_name).to eq "Jane"
|
@@ -114,49 +114,49 @@ describe PactasItero::Api::Customers do
|
|
114
114
|
|
115
115
|
describe ".customers" do
|
116
116
|
it "requests the correct resource" do
|
117
|
-
client = PactasItero::Client.new(bearer_token:
|
118
|
-
request = stub_get(
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
117
|
+
client = PactasItero::Client.new(bearer_token: "bt")
|
118
|
+
request = stub_get("/api/v1/customers").
|
119
|
+
to_return(
|
120
|
+
body: fixture("customers.json"),
|
121
|
+
headers: { content_type: "application/json; charset=utf-8" },
|
122
|
+
)
|
123
123
|
|
124
124
|
client.customers
|
125
125
|
|
126
126
|
expect(request).to have_been_made
|
127
127
|
end
|
128
128
|
|
129
|
-
it
|
130
|
-
client = PactasItero::Client.new(bearer_token:
|
131
|
-
request = stub_get(
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
129
|
+
it "returns an array of customers" do
|
130
|
+
client = PactasItero::Client.new(bearer_token: "bt")
|
131
|
+
request = stub_get("/api/v1/customers").
|
132
|
+
to_return(
|
133
|
+
body: fixture("customers.json"),
|
134
|
+
headers: { content_type: "application/json; charset=utf-8" },
|
135
|
+
)
|
136
136
|
|
137
137
|
customers = client.customers
|
138
138
|
|
139
139
|
expect(customers).to be_a Array
|
140
140
|
customer = customers.first
|
141
141
|
|
142
|
-
expect(customer.company_name).to eq
|
143
|
-
expect(customer.created_at).to eq
|
144
|
-
expect(customer.customer_name).to eq
|
145
|
-
expect(customer.customer_type).to eq
|
146
|
-
expect(customer.default_bearer_medium).to eq
|
147
|
-
expect(customer.email_address).to eq
|
148
|
-
expect(customer.external_customer_id).to eq
|
149
|
-
expect(customer.first_name).to eq
|
150
|
-
expect(customer.id).to eq
|
151
|
-
expect(customer.language).to eq
|
152
|
-
expect(customer.last_name
|
153
|
-
expect(customer.locale).to eq
|
154
|
-
expect(customer.vat_id).to eq
|
155
|
-
expect(customer.address.city).to eq
|
156
|
-
expect(customer.address.country).to eq
|
157
|
-
expect(customer.address.house_number).to eq
|
158
|
-
expect(customer.address.postal_code).to eq
|
159
|
-
expect(customer.address.street).to eq
|
142
|
+
expect(customer.company_name).to eq "Example Company"
|
143
|
+
expect(customer.created_at).to eq "2014-05-12T14:22:24.0000000Z"
|
144
|
+
expect(customer.customer_name).to eq "Example Company"
|
145
|
+
expect(customer.customer_type).to eq "Consumer"
|
146
|
+
expect(customer.default_bearer_medium).to eq "Email"
|
147
|
+
expect(customer.email_address).to eq "jane.doe@example.com"
|
148
|
+
expect(customer.external_customer_id).to eq ""
|
149
|
+
expect(customer.first_name).to eq "Jane"
|
150
|
+
expect(customer.id).to eq "5370d9201d8dd006288221b0"
|
151
|
+
expect(customer.language).to eq "de-DE"
|
152
|
+
expect(customer.last_name).to eq "Doe"
|
153
|
+
expect(customer.locale).to eq "de-DE"
|
154
|
+
expect(customer.vat_id).to eq "DE123456710"
|
155
|
+
expect(customer.address.city).to eq "Example City"
|
156
|
+
expect(customer.address.country).to eq "DE"
|
157
|
+
expect(customer.address.house_number).to eq "42"
|
158
|
+
expect(customer.address.postal_code).to eq "12345"
|
159
|
+
expect(customer.address.street).to eq "Example Street"
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
@@ -190,7 +190,7 @@ describe PactasItero::Api::Customers do
|
|
190
190
|
expect(address.street).to eq "Example Street"
|
191
191
|
|
192
192
|
expect(customer.company_name).to eq "Example Company"
|
193
|
-
expect(customer.default_bearer_medium).to eq"Email"
|
193
|
+
expect(customer.default_bearer_medium).to eq "Email"
|
194
194
|
expect(customer.email_address).to eq "jane.doe@example.com"
|
195
195
|
expect(customer.external_customer_id).to eq "1234"
|
196
196
|
expect(customer.first_name).to eq "Jane"
|
@@ -201,28 +201,30 @@ describe PactasItero::Api::Customers do
|
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
204
|
-
describe
|
205
|
-
it
|
206
|
-
client = PactasItero::Client.new(bearer_token:
|
207
|
-
request = stub_patch(
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
204
|
+
describe ".update_customer" do
|
205
|
+
it "requests the correct resource" do
|
206
|
+
client = PactasItero::Client.new(bearer_token: "bt")
|
207
|
+
request = stub_patch("/api/v1/customers/customer-id").
|
208
|
+
with(
|
209
|
+
body: {
|
210
|
+
CompanyName: "example & sons",
|
211
|
+
VatId: "DE555",
|
212
|
+
Address: { Street: "abc street" },
|
213
|
+
}.to_json,
|
214
|
+
).
|
215
|
+
to_return(
|
216
|
+
body: fixture("customer.json"),
|
217
|
+
headers: { content_type: "application/json; charset=utf-8" },
|
218
|
+
)
|
219
|
+
|
220
|
+
client.update_customer(
|
221
|
+
"customer-id", {
|
222
|
+
company_name: "example & sons",
|
223
|
+
vat_id: "DE555",
|
224
|
+
address: { street: "abc street" },
|
225
|
+
}
|
218
226
|
)
|
219
227
|
|
220
|
-
client.update_customer('customer-id', {
|
221
|
-
company_name: 'example & sons',
|
222
|
-
vat_id: 'DE555',
|
223
|
-
address: { street: 'abc street' }
|
224
|
-
})
|
225
|
-
|
226
228
|
expect(request).to have_been_made
|
227
229
|
end
|
228
230
|
end
|