Class: ChangeHealth::Response::Claim::ReportData

Inherits:
ResponseData
  • Object
show all
Defined in:
lib/change_health/response/claim/report/report_data.rb

Direct Known Subclasses

Report277Data, Report835Data

Instance Attribute Summary collapse

Attributes inherited from ResponseData

#raw, #response

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ResponseData

#errors, #errors?, #recommend_retry?

Constructor Details

#initialize(report_name, json, data: nil, response: nil) ⇒ ReportData

Returns a new instance of ReportData.



8
9
10
11
12
# File 'lib/change_health/response/claim/report/report_data.rb', line 8

def initialize(report_name, json, data: nil, response: nil)
  super(data: data, response: response)
  @report_name = report_name
  @json = json
end

Instance Attribute Details

#jsonObject (readonly) Also known as: json?

Returns the value of attribute json.



5
6
7
# File 'lib/change_health/response/claim/report/report_data.rb', line 5

def json
  @json
end

#report_nameObject (readonly)

Returns the value of attribute report_name.



5
6
7
# File 'lib/change_health/response/claim/report/report_data.rb', line 5

def report_name
  @report_name
end

Class Method Details

.is_277?(report_name) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/change_health/response/claim/report/report_data.rb', line 31

def self.is_277?(report_name)
  report_name.start_with?('X3')
end

.is_835?(report_name) ⇒ Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/change_health/response/claim/report/report_data.rb', line 39

def self.is_835?(report_name)
  report_name.start_with?('R5')
end

.report_type(report_name) ⇒ Object



22
23
24
25
# File 'lib/change_health/response/claim/report/report_data.rb', line 22

def self.report_type(report_name)
  return '277' if is_277?(report_name)
  return '835' if is_835?(report_name)
end

Instance Method Details

#edi?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/change_health/response/claim/report/report_data.rb', line 14

def edi?
  !@json
end

#is_277?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/change_health/response/claim/report/report_data.rb', line 27

def is_277?
  self.class.is_277?(@report_name)
end

#is_835?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/change_health/response/claim/report/report_data.rb', line 35

def is_835?
  self.class.is_835?(@report_name)
end

#presence(obj) ⇒ Object

Ripped from rails Object#presence method



44
45
46
# File 'lib/change_health/response/claim/report/report_data.rb', line 44

def presence(obj)
  obj unless obj.respond_to?(:empty?) ? !!obj.empty? : !obj
end

#report_typeObject



18
19
20
# File 'lib/change_health/response/claim/report/report_data.rb', line 18

def report_type
  self.class.report_type(@report_name)
end