Class: Nursys::License

Inherits:
Object
  • Object
show all
Defined in:
lib/nursys/license.rb

Constant Summary collapse

ATTRIBUTES =
[
    :license_number,
    :jurisdiction,
    :license_type,
    :record_ID
]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ License

Returns a new instance of License.



13
14
15
# File 'lib/nursys/license.rb', line 13

def initialize attributes={}
  attributes.each { |k, v| self.send("#{k}=", v) }
end

Class Method Details

.find(transaction_id) ⇒ Object



31
32
33
34
35
36
# File 'lib/nursys/license.rb', line 31

def find transaction_id
  response = Nursys::RetrieveNurseLookup.request(transaction_id)
  response[:nurse_lookup_response][:nurse_license_responses][:nurse_license_response][:success_flag] ?
      response[:nurse_lookup_response][:nurse_license_responses][:nurse_license_response][:nurse_licenses][:nurse_license] :
      response[:nurse_lookup_response][:nurse_license_responses][:nurse_license_response][:success_flag]
end

Instance Method Details

#saveObject



17
18
19
20
# File 'lib/nursys/license.rb', line 17

def save
  response = Nursys::SubmitNurseLookup.request(self.to_hash)
  response[:submit_nurse_lookup_response][:transaction][:transaction_success_flag] ? response[:submit_nurse_lookup_response][:transaction][:transaction_id] : response[:submit_nurse_lookup_response][:transaction][:transaction_success_flag]
end

#to_hashObject



22
23
24
25
26
27
28
# File 'lib/nursys/license.rb', line 22

def to_hash
  hash = Hash.new
  ATTRIBUTES.each do |attr|
    hash[attr.to_s.keyify] = self.send(attr)
  end
  hash
end