Class: OrcaApi::AcceptanceService::AcceptanceBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/orca_api/acceptance_service.rb

Overview

AcceptanceService#create,updateの引数を生成するクラス

AcceptanceBuilder.new.accept_at(Time.now).patient_id('00001').insurance_combination_number('01').to_h
# => { "Acceptance_Date" => "YYYY-MM-DD", "Acceptance_Time" => "HH:MM:SS", ... }

Instance Method Summary collapse

Constructor Details

#initializeAcceptanceBuilder

Returns a new instance of AcceptanceBuilder



102
103
104
105
# File 'lib/orca_api/acceptance_service.rb', line 102

def initialize
  @data = {}
  @health_insurance = {}
end

Constructor Details

#initializeAcceptanceBuilder

Returns a new instance of AcceptanceBuilder



102
103
104
105
# File 'lib/orca_api/acceptance_service.rb', line 102

def initialize
  @data = {}
  @health_insurance = {}
end

Instance Method Details

#accept_at(accept_at = Time.now) ⇒ Object



107
108
109
110
111
# File 'lib/orca_api/acceptance_service.rb', line 107

def accept_at(accept_at = Time.now)
  @data['Acceptance_Date'] = accept_at.strftime("%F")
  @data['Acceptance_Time'] = accept_at.strftime("%T")
  self
end

#insurance_combination_number(value) ⇒ Object



120
121
122
123
# File 'lib/orca_api/acceptance_service.rb', line 120

def insurance_combination_number(value)
  @health_insurance['Insurance_Combination_Number'] = value
  self
end

#to_hObject



125
126
127
# File 'lib/orca_api/acceptance_service.rb', line 125

def to_h
  @data.merge('HealthInsurance_Information' => @health_insurance)
end