class BigCheck::HCP

Constants

PROFESSION
SPECIALISM

Attributes

response[RW]

Public Class Methods

new(response) click to toggle source
# File lib/big_check/hcp.rb, line 30
def initialize response
  r = response[:list_hcp_approx4_result][:list_hcp_approx] ||= {}
  @response = r[:list_hcp_approx4] unless r.empty?
  @valid = (r.empty?) ? false : true
end

Public Instance Methods

invalid?() click to toggle source
# File lib/big_check/hcp.rb, line 77
def invalid?
  !@valid
end
profession() click to toggle source
# File lib/big_check/hcp.rb, line 43
def profession
  return false if invalid? || @response[:article_registration].nil?
  article = @response[:article_registration][:article_registration_ext_app]
  article = [article] if article.is_a? Hash
  arr = []
  article.each do |art|
    result = {}
    result[:code] = art[:professional_group_code]
    result[:value] = PROFESSION[art[:professional_group_code]]
    result[:from] = art[:article_registration_start_date]
    result[:to] =art[:article_registration_end_date]
    arr << result
  end
  return arr
end
specialism() click to toggle source
# File lib/big_check/hcp.rb, line 59
def specialism
  return false if invalid? || @response[:specialism].nil?
  article = @response[:specialism][:specialism_ext_app1]
  article = [article] if article.is_a? Hash
  arr = []
  article.each do |art|
    result = {}
    result[:code] = art[:type_of_specialism_id]
    result[:value] = SPECIALISM[art[:type_of_specialism_id]]
    arr << result
  end
  return arr
end
valid?() click to toggle source
# File lib/big_check/hcp.rb, line 73
def valid?
  @valid
end

Private Instance Methods

loop_through_values(object, item, lookup) click to toggle source
# File lib/big_check/hcp.rb, line 85
def loop_through_values object, item, lookup
  array = []
  object.each do |o|
    code = o[item]
    array.push({code: code, value: lookup[code]})
  end
  array
end