Module: CrvApiClient::Helpers::Crv

Includes:
Endpoint
Defined in:
lib/crv_api_client/helpers/crv.rb

Instance Method Summary collapse

Instance Method Details

#context_message(keeper, context_message_detail: [], username: "", password: "", provider: nil, customer: nil, animal: nil, process_code: "", organisation: nil) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/crv_api_client/helpers/crv.rb', line 38

def context_message(keeper,
                    context_message_detail: [],
                    username: "",
                    password: "",
                    provider: nil,
                    customer: nil,
                    animal: nil,
                    process_code: "",
                    organisation: nil)
  context = endpoint_context_message.new
  context.sessionId = ""
  context.processId = ""
  context.instanceId = ""
  context.username = username
  context.userType = "C"
  context.password = password
  context.organisation = organisation
  context.provider = provider
  context.customer = customer
  context.keeper = keeper
  context.animal = animal
  context.processCode = process_code
  context.messageSource = ""
  context.languageCode = ""
  context.timeZone = ""
  context.contextMessageDetail = context_message_detail
  context
end

#get_crv_organisation_code(country) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/crv_api_client/helpers/crv.rb', line 27

def get_crv_organisation_code(country)
  country = country.upcase unless country.nil?
  value = case country
            when nil, "NL" then "crv.nl" # Netherlands
            when "BE" then "crv.be" # Belgium
            when "DE" then "crv.de" # Germany
            when "CZ" then "crv.cz" # Czech
          end
  value
end

#get_keeper(crv_id, country) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/crv_api_client/helpers/crv.rb', line 6

def get_keeper(crv_id, country)
  keeper = endpoint_participant_id.new
  keeper.participantCode = crv_id
  country = country.upcase unless country.nil?
  case(country)
    when nil, "NL" # Netherlands
      keeper.participantCodeType = "UBN"
      keeper.countryCode = "NLD"
    when "BE" # Belgium
      keeper.participantCodeType = "UVN"
      keeper.countryCode = "BE"
    when "DE" # Germany
      keeper.participantCodeType = "LDE"
      keeper.countryCode = "DE"
    when "CZ" # Czech
      keeper.participantCodeType = "LCZ"
      keeper.countryCode = "CZ"
  end
  keeper
end