crv_api_client 0.1.3
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 +7 -0
- data/.gitignore +26 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/Guardfile +10 -0
- data/LICENSE.txt +22 -0
- data/README.md +47 -0
- data/Rakefile +7 -0
- data/crv_api_client.gemspec +30 -0
- data/lib/crv_api_client/animals.rb +84 -0
- data/lib/crv_api_client/api/animals/animals.rb +1734 -0
- data/lib/crv_api_client/api/animals/animals_driver.rb +113 -0
- data/lib/crv_api_client/api/animals/animals_mapping_registry.rb +2082 -0
- data/lib/crv_api_client/api/animals/rs_animal_service_client.rb +122 -0
- data/lib/crv_api_client/api/animals.rb +9 -0
- data/lib/crv_api_client/api/reproduction/esb_rs_reproduction_service_client.rb +158 -0
- data/lib/crv_api_client/api/reproduction/reproduction.rb +8810 -0
- data/lib/crv_api_client/api/reproduction/reproduction_driver.rb +136 -0
- data/lib/crv_api_client/api/reproduction/reproduction_mapping_registry.rb +5244 -0
- data/lib/crv_api_client/api/reproduction.rb +9 -0
- data/lib/crv_api_client/api.rb +6 -0
- data/lib/crv_api_client/errors.rb +57 -0
- data/lib/crv_api_client/helpers/attributes.rb +34 -0
- data/lib/crv_api_client/helpers/crv.rb +89 -0
- data/lib/crv_api_client/helpers/endpoint.rb +46 -0
- data/lib/crv_api_client/helpers.rb +7 -0
- data/lib/crv_api_client/reproduction.rb +87 -0
- data/lib/crv_api_client/utils/configuration.rb +40 -0
- data/lib/crv_api_client/utils.rb +5 -0
- data/lib/crv_api_client/version.rb +3 -0
- data/lib/crv_api_client.rb +26 -0
- data/spec/lib/crv/animals_spec.rb +95 -0
- data/spec/lib/crv/api/animals/animals_driver_spec.rb +39 -0
- data/spec/lib/crv/api/reproduction/reproduction_driver_spec.rb +39 -0
- data/spec/lib/crv/helpers/attributes_spec.rb +52 -0
- data/spec/lib/crv/helpers/crv_spec.rb +146 -0
- data/spec/lib/crv/helpers/endpoint_spec.rb +54 -0
- data/spec/lib/crv/reproduction_spec.rb +137 -0
- data/spec/lib/crv_spec.rb +22 -0
- data/spec/spec_helper.rb +91 -0
- metadata +204 -0
@@ -0,0 +1,146 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::CrvApiClient::Helpers::Crv do
|
4
|
+
let(:tested_class) { Class.new { include ::CrvApiClient::Helpers::Crv }.new }
|
5
|
+
let(:participant_code) { '123' }
|
6
|
+
context 'get_keeper' do
|
7
|
+
it 'should return an ParticipatId class' do
|
8
|
+
expect(tested_class).to receive(:endpoint_participant_id).and_return(::CrvApiClient::Api::Animals::ParticipantId)
|
9
|
+
result = tested_class.get_keeper("123",nil)
|
10
|
+
expect(result).to be_an(::CrvApiClient::Api::Animals::ParticipantId)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should return netherlands type when country is nil' do
|
14
|
+
expect(tested_class).to receive(:endpoint_participant_id).and_return(::CrvApiClient::Api::Animals::ParticipantId)
|
15
|
+
|
16
|
+
result = tested_class.get_keeper(participant_code,nil)
|
17
|
+
expect(result.countryCode).to eq("NLD")
|
18
|
+
expect(result.participantCode).to be(participant_code)
|
19
|
+
expect(result.participantCodeType).to eq("UBN")
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should return netherlands type when country is NL' do
|
23
|
+
expect(tested_class).to receive(:endpoint_participant_id).and_return(::CrvApiClient::Api::Animals::ParticipantId)
|
24
|
+
|
25
|
+
result = tested_class.get_keeper(participant_code,"nl")
|
26
|
+
expect(result.countryCode).to eq("NLD")
|
27
|
+
expect(result.participantCode).to be(participant_code)
|
28
|
+
expect(result.participantCodeType).to eq("UBN")
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should return german type when country is DE' do
|
32
|
+
expect(tested_class).to receive(:endpoint_participant_id).and_return(::CrvApiClient::Api::Animals::ParticipantId)
|
33
|
+
|
34
|
+
result = tested_class.get_keeper(participant_code,"DE")
|
35
|
+
expect(result.countryCode).to eq("DE")
|
36
|
+
expect(result.participantCode).to be(participant_code)
|
37
|
+
expect(result.participantCodeType).to eq("LDE")
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should return belgian type when country is BE' do
|
41
|
+
expect(tested_class).to receive(:endpoint_participant_id).and_return(::CrvApiClient::Api::Animals::ParticipantId)
|
42
|
+
|
43
|
+
result = tested_class.get_keeper(participant_code,"BE")
|
44
|
+
expect(result.countryCode).to eq("BE")
|
45
|
+
expect(result.participantCode).to be(participant_code)
|
46
|
+
expect(result.participantCodeType).to eq("UVN")
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should return czech type when country is CZ' do
|
50
|
+
expect(tested_class).to receive(:endpoint_participant_id).and_return(::CrvApiClient::Api::Animals::ParticipantId)
|
51
|
+
|
52
|
+
result = tested_class.get_keeper(participant_code,"CZ")
|
53
|
+
expect(result.countryCode).to eq("CZ")
|
54
|
+
expect(result.participantCode).to be(participant_code)
|
55
|
+
expect(result.participantCodeType).to eq("LCZ")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
context :get_crv_organisation_code do
|
60
|
+
|
61
|
+
it 'should return netherlands crv code when country is nil' do
|
62
|
+
result = tested_class.get_crv_organisation_code nil
|
63
|
+
expect(result).to eq("crv.nl")
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'should return netherlands crv code when country is NL' do
|
67
|
+
result = tested_class.get_crv_organisation_code "nl"
|
68
|
+
expect(result).to eq("crv.nl")
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should return german crv code when country is DE' do
|
72
|
+
result = tested_class.get_crv_organisation_code "DE"
|
73
|
+
expect(result).to eq("crv.de")
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should return belgian crv code when country is BE' do
|
77
|
+
result = tested_class.get_crv_organisation_code "BE"
|
78
|
+
expect(result).to eq("crv.be")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context 'perform_service_message_validation' do
|
83
|
+
it 'should throw an crv error on an error' do
|
84
|
+
serviceMessage = ::CrvApiClient::Api::Animals::ServiceMessage.new("200","200","some error","somme type")
|
85
|
+
expect{tested_class.send(:perform_service_message_validation,serviceMessage)}.to raise_error(::CrvApiClient::Errors::CrvRequestError)
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'should throw an crv error on an error on an Reproduction Service message' do
|
89
|
+
serviceMessage = ::CrvApiClient::Api::Reproduction::ServiceMessage.new("200","200","some error","somme type")
|
90
|
+
expect{tested_class.send(:perform_service_message_validation,serviceMessage)}.to raise_error(::CrvApiClient::Errors::CrvRequestError)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
|
95
|
+
context 'context_message' do
|
96
|
+
it 'should return a context message' do
|
97
|
+
username = "abc"
|
98
|
+
password = "efg"
|
99
|
+
keeper = ::CrvApiClient::Api::Reproduction::ParticipantId.new("a","b","c")
|
100
|
+
animalid = ::CrvApiClient::Api::Reproduction::AnimalId.new("b","c")
|
101
|
+
contextmessageDetail = [::CrvApiClient::Api::Reproduction::ContextMessageDetail.new("",""), ::CrvApiClient::Api::Reproduction::ContextMessageDetail.new("b","c")]
|
102
|
+
processCode = "102"
|
103
|
+
organisation = ::CrvApiClient::Api::Reproduction::ParticipantId.new("or","b","c")
|
104
|
+
crv_customer = ::CrvApiClient::Api::Reproduction::ParticipantId.new("10106605","PAR","NLD")
|
105
|
+
crv_provider = ::CrvApiClient::Api::Reproduction::ParticipantId.new("2323","test","asd")
|
106
|
+
|
107
|
+
expect(tested_class).to receive(:endpoint_context_message).and_return(::CrvApiClient::Api::Reproduction::ContextMessage)
|
108
|
+
message = tested_class.send(:context_message, keeper,
|
109
|
+
animal: animalid,
|
110
|
+
username: username,
|
111
|
+
password: password,
|
112
|
+
context_message_detail: contextmessageDetail,
|
113
|
+
process_code: processCode,
|
114
|
+
customer: crv_customer,
|
115
|
+
provider: crv_provider,
|
116
|
+
organisation: organisation)
|
117
|
+
|
118
|
+
expect(message.animal).to be(animalid)
|
119
|
+
expect(message.keeper).to be(keeper)
|
120
|
+
expect(message.contextMessageDetail).to be(contextmessageDetail)
|
121
|
+
expect(message.processCode).to be (processCode)
|
122
|
+
expect(message.username).to be(username)
|
123
|
+
expect(message.password).to be(password)
|
124
|
+
expect(message.organisation).to be(organisation)
|
125
|
+
expect(message.customer).to be(crv_customer)
|
126
|
+
expect(message.provider).to be(crv_provider)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
context 'keeper_and_context_message_detail' do
|
131
|
+
it 'should return an keeper and context message' do
|
132
|
+
crv_id = 29
|
133
|
+
country_code = "NL"
|
134
|
+
keeper = ::CrvApiClient::Api::Reproduction::ParticipantId.new(crv_id,"",country_code)
|
135
|
+
expect(tested_class).to receive(:endpoint_context_message_detail).and_return(::CrvApiClient::Api::Reproduction::ContextMessageDetail)
|
136
|
+
expect(tested_class).to receive(:get_keeper).with(crv_id.to_s,country_code).and_return(keeper)
|
137
|
+
|
138
|
+
keeper, context_message = tested_class.send(:keeper_and_context_message_detail, crv_id, country_code)
|
139
|
+
expect(keeper).to be_a(::CrvApiClient::Api::Reproduction::ParticipantId)
|
140
|
+
expect(keeper).to eq(keeper)
|
141
|
+
expect(context_message).to be_a(::CrvApiClient::Api::Reproduction::ContextMessageDetail)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
end
|
146
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::CrvApiClient::Helpers::Endpoint do
|
4
|
+
CrvApiClient::Helpers.const_set("SomeClass", Class.new() { include ::CrvApiClient::Helpers::Endpoint } )
|
5
|
+
Object.const_set("NoModuleClass", Class.new() { include ::CrvApiClient::Helpers::Endpoint } )
|
6
|
+
let(:tested_class) { CrvApiClient::Helpers::SomeClass.new}
|
7
|
+
let(:animal_class) { CrvApiClient::Animals.new}
|
8
|
+
let(:reproduction_class) { CrvApiClient::Reproduction.new}
|
9
|
+
|
10
|
+
shared_examples 'endpoint resolver' do |klass_under_test,expected_klass, method|
|
11
|
+
it "and should create a #{expected_klass} from a #{klass_under_test}" do
|
12
|
+
klass_instance = klass_under_test.new
|
13
|
+
klass_instance.extend(::CrvApiClient::Helpers::Endpoint)
|
14
|
+
expect(Object).to receive(:const_get).with(expected_klass.name).and_return(expected_klass.new)
|
15
|
+
klass = klass_instance.send(method)
|
16
|
+
expect(klass).to be_a(expected_klass)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'class_api_endpoint' do
|
21
|
+
it "should add the module api before the class name" do
|
22
|
+
result = tested_class.send(:class_api_endpoint)
|
23
|
+
expect(result).to eq("CrvApiClient::Helpers::Api::SomeClass::")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should return the class when namespace cant be found" do
|
27
|
+
result = NoModuleClass.new.send(:class_api_endpoint)
|
28
|
+
expect(result).to eq("NoModuleClass")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
context 'endpoint_participant_id' do
|
34
|
+
it_behaves_like 'endpoint resolver' , CrvApiClient::Animals, CrvApiClient::Api::Animals::ParticipantId, :endpoint_participant_id
|
35
|
+
it_behaves_like 'endpoint resolver' , CrvApiClient::Reproduction, CrvApiClient::Api::Reproduction::ParticipantId, :endpoint_participant_id
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'endpoint_context_message_detail' do
|
39
|
+
it_behaves_like 'endpoint resolver' , CrvApiClient::Animals, CrvApiClient::Api::Animals::ContextMessageDetail, :endpoint_context_message_detail
|
40
|
+
it_behaves_like 'endpoint resolver' , CrvApiClient::Reproduction, CrvApiClient::Api::Reproduction::ContextMessageDetail, :endpoint_context_message_detail
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'endpoint_context_message' do
|
44
|
+
it_behaves_like 'endpoint resolver' , CrvApiClient::Animals, CrvApiClient::Api::Animals::ContextMessage, :endpoint_context_message
|
45
|
+
it_behaves_like 'endpoint resolver' , CrvApiClient::Reproduction, CrvApiClient::Api::Reproduction::ContextMessage, :endpoint_context_message
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'endpoint_animal_id' do
|
49
|
+
it_behaves_like 'endpoint resolver' , CrvApiClient::Animals, CrvApiClient::Api::Animals::AnimalId, :endpoint_animal_id
|
50
|
+
it_behaves_like 'endpoint resolver' , CrvApiClient::Reproduction, CrvApiClient::Api::Reproduction::AnimalId, :endpoint_animal_id
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
|
@@ -0,0 +1,137 @@
|
|
1
|
+
describe CrvApiClient::Reproduction do
|
2
|
+
let(:endpoint) { "https://localhost/reproduction" }
|
3
|
+
let(:default_content_type) { 'application/json' }
|
4
|
+
|
5
|
+
let(:animal) {::CrvApiClient::Api::Reproduction::AnimalId.new("b","c")}
|
6
|
+
let(:config_customer) { {participant_code:"10106605",participant_code_type:"PAR", country_code:"NLD"} }
|
7
|
+
let(:config_provider) { {participant_code:"2323",participant_code_type:"test", country_code:"asd"} }
|
8
|
+
let(:crv_customer) { ::CrvApiClient::Api::Reproduction::ParticipantId.new("10106605","PAR","NLD")}
|
9
|
+
let(:crv_provider) { ::CrvApiClient::Api::Reproduction::ParticipantId.new("2323","test","asd")}
|
10
|
+
let(:username) {"Username"}
|
11
|
+
let(:password) {"password"}
|
12
|
+
|
13
|
+
let(:client) { CrvApiClient::Reproduction.new }
|
14
|
+
let(:configured_client) { ::CrvApiClient::Reproduction.new(endpoint, username: username, password: password, customer: config_customer, provider: config_provider ) }
|
15
|
+
context 'initialization' do
|
16
|
+
|
17
|
+
it "should initalize the client with given parameters" do
|
18
|
+
expect(configured_client.endpoint_url).to eq(endpoint)
|
19
|
+
expect(configured_client.username).to eq(username)
|
20
|
+
expect(configured_client.password).to eql(password)
|
21
|
+
expect(configured_client.customer).to be_a(::CrvApiClient::Api::Reproduction::ParticipantId)
|
22
|
+
expect(configured_client.provider).to be_a(::CrvApiClient::Api::Reproduction::ParticipantId)
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should initialize with the configured attributes as default" do
|
27
|
+
CrvApiClient.configure do |conf|
|
28
|
+
conf.endpoint_reproduction = endpoint
|
29
|
+
conf.username = username
|
30
|
+
conf.password = password
|
31
|
+
conf.customer = config_customer
|
32
|
+
end
|
33
|
+
|
34
|
+
expect(client.endpoint_url).to eq(endpoint)
|
35
|
+
expect(client.username).to eq(username)
|
36
|
+
expect(client.password).to eq(password)
|
37
|
+
expect(client.customer).to be_a(::CrvApiClient::Api::Reproduction::ParticipantId)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'list_reproduction_last_parity' do
|
42
|
+
it 'should list animals' do
|
43
|
+
crv_id = 20
|
44
|
+
country_code = "nl"
|
45
|
+
process_code = "2838"
|
46
|
+
context_message = CrvApiClient::Api::Reproduction::ContextMessage.new
|
47
|
+
keeper = ::CrvApiClient::Api::Reproduction::ParticipantId.new(crv_id,"",country_code)
|
48
|
+
context_message_detail = ::CrvApiClient::Api::Reproduction::ContextMessageDetail.new("a","b")
|
49
|
+
animal_request = CrvApiClient::Api::Reproduction::ParticipantAnimalRequest.new
|
50
|
+
animal_request_list = CrvApiClient::Api::Reproduction::ListParticipantAnimalRequest.new
|
51
|
+
requestType = CrvApiClient::Api::Reproduction::ListReproductionLastParityRequestType.new
|
52
|
+
service_message = ::CrvApiClient::Api::Reproduction::ServiceMessage
|
53
|
+
response = ::CrvApiClient::Api::Reproduction::ListReproductionLastParityResponse.new(nil,service_message)
|
54
|
+
driver = configured_client.send(:driver)
|
55
|
+
|
56
|
+
expect(configured_client).to receive(:keeper_and_context_message_detail).with(crv_id, country_code).and_return([keeper,context_message_detail]).once
|
57
|
+
expect(configured_client).to receive(:context_message).with(keeper, username: username, password: password, customer: instance_of(CrvApiClient::Api::Reproduction::ParticipantId), provider: instance_of(CrvApiClient::Api::Reproduction::ParticipantId), animal: nil, context_message_detail: context_message_detail, process_code: process_code, organisation: nil).and_return(context_message).once
|
58
|
+
expect(configured_client).to receive(:participant_animal_request).with("TRP","PED").and_return(animal_request).once
|
59
|
+
expect(configured_client).to receive(:list_participant_animal_request).with("SHORT",[animal_request]).and_return(animal_request_list).once
|
60
|
+
expect(configured_client).to receive(:list_reproduction_last_parity_request_type).with(keeper,animal_request_list).and_return(requestType).once
|
61
|
+
expect(driver).to receive(:listReproductionLastParity).with(satisfy { |message|
|
62
|
+
expect(message).to be_a(CrvApiClient::Api::Reproduction::ListReproductionLastParityRequest)
|
63
|
+
expect(message.requestMessage).to be_a(CrvApiClient::Api::Reproduction::ListReproductionLastParityRequestType)
|
64
|
+
expect(message.requestMessage).to be(requestType)
|
65
|
+
expect(message.contextMessage).to be(context_message)
|
66
|
+
}).and_return(response).once
|
67
|
+
expect(configured_client).to receive(:perform_service_message_validation).with(service_message).once
|
68
|
+
|
69
|
+
configured_client.list_reproduction_last_parity(crv_id,country_code,process_code: process_code)
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'should not handle message validations when option is given.' do
|
74
|
+
crv_id = 20
|
75
|
+
country_code = "nl"
|
76
|
+
process_code = "2838"
|
77
|
+
context_message = CrvApiClient::Api::Reproduction::ContextMessage.new
|
78
|
+
keeper = ::CrvApiClient::Api::Reproduction::ParticipantId.new(crv_id,"",country_code)
|
79
|
+
context_message_detail = ::CrvApiClient::Api::Reproduction::ContextMessageDetail.new("a","b")
|
80
|
+
animal_request = CrvApiClient::Api::Reproduction::ParticipantAnimalRequest.new
|
81
|
+
animal_request_list = CrvApiClient::Api::Reproduction::ListParticipantAnimalRequest.new
|
82
|
+
requestType = CrvApiClient::Api::Reproduction::ListReproductionLastParityRequestType.new
|
83
|
+
service_message = ::CrvApiClient::Api::Reproduction::ServiceMessage
|
84
|
+
response = ::CrvApiClient::Api::Reproduction::ListReproductionLastParityResponse.new(nil,service_message)
|
85
|
+
driver = configured_client.send(:driver)
|
86
|
+
|
87
|
+
expect(configured_client).to receive(:keeper_and_context_message_detail).with(crv_id, country_code).and_return([keeper,context_message_detail]).once
|
88
|
+
expect(configured_client).to receive(:context_message).with(keeper, username: username, password: password, customer: instance_of(CrvApiClient::Api::Reproduction::ParticipantId), provider: instance_of(CrvApiClient::Api::Reproduction::ParticipantId), animal: nil, context_message_detail: context_message_detail, process_code: process_code, organisation: nil).and_return(context_message).once
|
89
|
+
expect(configured_client).to receive(:participant_animal_request).with("TRP","PED").and_return(animal_request).once
|
90
|
+
expect(configured_client).to receive(:list_participant_animal_request).with("SHORT",[animal_request]).and_return(animal_request_list).once
|
91
|
+
expect(configured_client).to receive(:list_reproduction_last_parity_request_type).with(keeper,animal_request_list).and_return(requestType).once
|
92
|
+
expect(driver).to receive(:listReproductionLastParity).with(satisfy { |message|
|
93
|
+
expect(message).to be_a(CrvApiClient::Api::Reproduction::ListReproductionLastParityRequest)
|
94
|
+
expect(message.requestMessage).to be_a(CrvApiClient::Api::Reproduction::ListReproductionLastParityRequestType)
|
95
|
+
expect(message.requestMessage).to be(requestType)
|
96
|
+
expect(message.contextMessage).to be(context_message)
|
97
|
+
}).and_return(response).once
|
98
|
+
expect(configured_client).to receive(:perform_service_message_validation).with(service_message).never
|
99
|
+
|
100
|
+
response = configured_client.list_reproduction_last_parity(crv_id,country_code,process_code: process_code, options: {validate: false})
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
context 'list_reproduction_last_parity_request_type' do
|
105
|
+
it 'should create a new ListReproductionLastParityRequestType' do
|
106
|
+
keeper = ::CrvApiClient::Api::Reproduction::ParticipantId.new
|
107
|
+
participant_animal_request = CrvApiClient::Api::Reproduction::ListParticipantAnimalRequest.new
|
108
|
+
result = configured_client.send(:list_reproduction_last_parity_request_type, keeper,participant_animal_request)
|
109
|
+
expect(result).to be_a(CrvApiClient::Api::Reproduction::ListReproductionLastParityRequestType)
|
110
|
+
expect(result.keeper).to be(keeper)
|
111
|
+
expect(result.participantAnimalRequest).to be(participant_animal_request)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
context 'list_participant_animal_request' do
|
116
|
+
it 'should create a new ListParticipantAnimalRequest' do
|
117
|
+
list_type = "SHORT"
|
118
|
+
participant_animal_request = CrvApiClient::Api::Reproduction::ParticipantAnimalRequest.new
|
119
|
+
result = configured_client.send(:list_participant_animal_request, list_type, participant_animal_request)
|
120
|
+
expect(result).to be_a(CrvApiClient::Api::Reproduction::ListParticipantAnimalRequest)
|
121
|
+
expect(result.listType).to be(list_type)
|
122
|
+
expect(result.participantAnimalRequest).to be(participant_animal_request)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
context 'participant_animal_request' do
|
127
|
+
it 'should create a new ListParticipantAnimalRequest' do
|
128
|
+
number_type = "TRP"
|
129
|
+
number_sub_type= "PED"
|
130
|
+
result = configured_client.send(:participant_animal_request, number_type, number_sub_type)
|
131
|
+
expect(result).to be_a(CrvApiClient::Api::Reproduction::ParticipantAnimalRequest)
|
132
|
+
expect(result.numberType).to be(number_type)
|
133
|
+
expect(result.numberSubType).to be(number_sub_type)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CrvApiClient do
|
4
|
+
|
5
|
+
describe "configure" do
|
6
|
+
it "should assign endpoints" do
|
7
|
+
animals = "EndpointAnimals"
|
8
|
+
reproduction = "EndpointReproduction"
|
9
|
+
result = CrvApiClient.configure do |config|
|
10
|
+
config.endpoint_animals = animals
|
11
|
+
config.endpoint_reproduction = reproduction
|
12
|
+
end
|
13
|
+
|
14
|
+
expect(CrvApiClient.configuration.endpoint_animals).to eq(animals)
|
15
|
+
expect(CrvApiClient.configuration.endpoint_reproduction).to eq(reproduction)
|
16
|
+
|
17
|
+
expect(result).to be_truthy
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
4
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
5
|
+
#
|
6
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
7
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
8
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
9
|
+
# individual file that may not need all of that loaded. Instead, make a
|
10
|
+
# separate helper file that requires this one and then use it only in the specs
|
11
|
+
# that actually need it.
|
12
|
+
#
|
13
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
14
|
+
# users commonly want.
|
15
|
+
#
|
16
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
17
|
+
require 'crv_api_client'
|
18
|
+
|
19
|
+
require 'webmock/rspec'
|
20
|
+
require 'vcr'
|
21
|
+
|
22
|
+
|
23
|
+
VCR.configure do |c|
|
24
|
+
c.cassette_library_dir = 'spec/fixtures/vcr'
|
25
|
+
c.hook_into :webmock
|
26
|
+
c.ignore_localhost = true
|
27
|
+
c.configure_rspec_metadata!
|
28
|
+
end
|
29
|
+
|
30
|
+
RSpec.configure do |config|
|
31
|
+
# The settings below are suggested to provide a good initial experience
|
32
|
+
# with RSpec, but feel free to customize to your heart's content.
|
33
|
+
=begin
|
34
|
+
# These two settings work together to allow you to limit a spec run
|
35
|
+
# to individual examples or groups you care about by tagging them with
|
36
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
37
|
+
# get run.
|
38
|
+
config.filter_run :focus
|
39
|
+
config.run_all_when_everything_filtered = true
|
40
|
+
|
41
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
42
|
+
# file, and it's useful to allow more verbose output when running an
|
43
|
+
# individual spec file.
|
44
|
+
if config.files_to_run.one?
|
45
|
+
# Use the documentation formatter for detailed output,
|
46
|
+
# unless a formatter has already been configured
|
47
|
+
# (e.g. via a command-line flag).
|
48
|
+
config.default_formatter = 'doc'
|
49
|
+
end
|
50
|
+
|
51
|
+
# Print the 10 slowest examples and example groups at the
|
52
|
+
# end of the spec run, to help surface which specs are running
|
53
|
+
# particularly slow.
|
54
|
+
config.profile_examples = 10
|
55
|
+
|
56
|
+
# Run specs in random order to surface order dependencies. If you find an
|
57
|
+
# order dependency and want to debug it, you can fix the order by providing
|
58
|
+
# the seed, which is printed after each run.
|
59
|
+
# --seed 1234
|
60
|
+
config.order = :random
|
61
|
+
|
62
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
63
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
64
|
+
# test failures related to randomization by passing the same `--seed` value
|
65
|
+
# as the one that triggered the failure.
|
66
|
+
Kernel.srand config.seed
|
67
|
+
|
68
|
+
# rspec-expectations config goes here. You can use an alternate
|
69
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
70
|
+
# assertions if you prefer.
|
71
|
+
config.expect_with :rspec do |expectations|
|
72
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
73
|
+
# For more details, see:
|
74
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
75
|
+
expectations.syntax = :expect
|
76
|
+
end
|
77
|
+
|
78
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
79
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
80
|
+
config.mock_with :rspec do |mocks|
|
81
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
82
|
+
# For more details, see:
|
83
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
84
|
+
mocks.syntax = :expect
|
85
|
+
|
86
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
87
|
+
# a real object. This is generally recommended.
|
88
|
+
mocks.verify_partial_doubles = true
|
89
|
+
end
|
90
|
+
=end
|
91
|
+
end
|
metadata
ADDED
@@ -0,0 +1,204 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: crv_api_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nedap
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-10-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: soap4r-ruby1.9
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.0.5
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.0.5
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.0.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.0.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.6.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.6.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 4.2.10
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 4.2.10
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: webmock
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.18.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.18.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: vcr
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 2.9.2
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 2.9.2
|
125
|
+
description: CRV API client
|
126
|
+
email:
|
127
|
+
- development-lm@nedap.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".gitignore"
|
133
|
+
- ".rspec"
|
134
|
+
- Gemfile
|
135
|
+
- Guardfile
|
136
|
+
- LICENSE.txt
|
137
|
+
- README.md
|
138
|
+
- Rakefile
|
139
|
+
- crv_api_client.gemspec
|
140
|
+
- lib/crv_api_client.rb
|
141
|
+
- lib/crv_api_client/animals.rb
|
142
|
+
- lib/crv_api_client/api.rb
|
143
|
+
- lib/crv_api_client/api/animals.rb
|
144
|
+
- lib/crv_api_client/api/animals/animals.rb
|
145
|
+
- lib/crv_api_client/api/animals/animals_driver.rb
|
146
|
+
- lib/crv_api_client/api/animals/animals_mapping_registry.rb
|
147
|
+
- lib/crv_api_client/api/animals/rs_animal_service_client.rb
|
148
|
+
- lib/crv_api_client/api/reproduction.rb
|
149
|
+
- lib/crv_api_client/api/reproduction/esb_rs_reproduction_service_client.rb
|
150
|
+
- lib/crv_api_client/api/reproduction/reproduction.rb
|
151
|
+
- lib/crv_api_client/api/reproduction/reproduction_driver.rb
|
152
|
+
- lib/crv_api_client/api/reproduction/reproduction_mapping_registry.rb
|
153
|
+
- lib/crv_api_client/errors.rb
|
154
|
+
- lib/crv_api_client/helpers.rb
|
155
|
+
- lib/crv_api_client/helpers/attributes.rb
|
156
|
+
- lib/crv_api_client/helpers/crv.rb
|
157
|
+
- lib/crv_api_client/helpers/endpoint.rb
|
158
|
+
- lib/crv_api_client/reproduction.rb
|
159
|
+
- lib/crv_api_client/utils.rb
|
160
|
+
- lib/crv_api_client/utils/configuration.rb
|
161
|
+
- lib/crv_api_client/version.rb
|
162
|
+
- spec/lib/crv/animals_spec.rb
|
163
|
+
- spec/lib/crv/api/animals/animals_driver_spec.rb
|
164
|
+
- spec/lib/crv/api/reproduction/reproduction_driver_spec.rb
|
165
|
+
- spec/lib/crv/helpers/attributes_spec.rb
|
166
|
+
- spec/lib/crv/helpers/crv_spec.rb
|
167
|
+
- spec/lib/crv/helpers/endpoint_spec.rb
|
168
|
+
- spec/lib/crv/reproduction_spec.rb
|
169
|
+
- spec/lib/crv_spec.rb
|
170
|
+
- spec/spec_helper.rb
|
171
|
+
homepage: https://nedap.com
|
172
|
+
licenses:
|
173
|
+
- MIT
|
174
|
+
metadata: {}
|
175
|
+
post_install_message:
|
176
|
+
rdoc_options: []
|
177
|
+
require_paths:
|
178
|
+
- lib
|
179
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - ">="
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '0'
|
184
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - ">="
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '0'
|
189
|
+
requirements: []
|
190
|
+
rubyforge_project:
|
191
|
+
rubygems_version: 2.7.7
|
192
|
+
signing_key:
|
193
|
+
specification_version: 4
|
194
|
+
summary: A Wrapper for the CRV soap API.
|
195
|
+
test_files:
|
196
|
+
- spec/lib/crv/animals_spec.rb
|
197
|
+
- spec/lib/crv/api/animals/animals_driver_spec.rb
|
198
|
+
- spec/lib/crv/api/reproduction/reproduction_driver_spec.rb
|
199
|
+
- spec/lib/crv/helpers/attributes_spec.rb
|
200
|
+
- spec/lib/crv/helpers/crv_spec.rb
|
201
|
+
- spec/lib/crv/helpers/endpoint_spec.rb
|
202
|
+
- spec/lib/crv/reproduction_spec.rb
|
203
|
+
- spec/lib/crv_spec.rb
|
204
|
+
- spec/spec_helper.rb
|