Class: ChangeHealth::Response::EligibilityBenefits
- Inherits:
-
Array
- Object
- Array
- ChangeHealth::Response::EligibilityBenefits
- Defined in:
- lib/change_health/response/eligibility/eligibility_benefits.rb
Instance Method Summary collapse
- #+(other_obj) ⇒ Object
- #find_by(**kwargs) ⇒ Object
- #in_network ⇒ Object
-
#initialize(benefits) ⇒ EligibilityBenefits
constructor
A new instance of EligibilityBenefits.
- #where(**kwargs) ⇒ Object
- #where_not(**kwargs) ⇒ Object
Constructor Details
#initialize(benefits) ⇒ EligibilityBenefits
Returns a new instance of EligibilityBenefits.
4 5 6 |
# File 'lib/change_health/response/eligibility/eligibility_benefits.rb', line 4 def initialize(benefits) super(benefits.map {|benefit| ChangeHealth::Response::EligibilityBenefit.new(benefit) }) end |
Instance Method Details
#+(other_obj) ⇒ Object
16 17 18 |
# File 'lib/change_health/response/eligibility/eligibility_benefits.rb', line 16 def +(other_obj) self.class.new(self.to_a + other_obj.to_a) end |
#find_by(**kwargs) ⇒ Object
20 21 22 |
# File 'lib/change_health/response/eligibility/eligibility_benefits.rb', line 20 def find_by(**kwargs) self.find {|benefit| kwargs.all? {|k,v| benefit[k].is_a?(Array) ? benefit[k].include?(v) : v == benefit[k] } } end |
#in_network ⇒ Object
24 25 26 |
# File 'lib/change_health/response/eligibility/eligibility_benefits.rb', line 24 def in_network self.where(inPlanNetworkIndicatorCode: 'Y') end |
#where(**kwargs) ⇒ Object
8 9 10 |
# File 'lib/change_health/response/eligibility/eligibility_benefits.rb', line 8 def where(**kwargs) self.class.new(self.select {|benefit| kwargs.all? {|k,v| benefit_matches?(benefit, k, v) } }) end |
#where_not(**kwargs) ⇒ Object
12 13 14 |
# File 'lib/change_health/response/eligibility/eligibility_benefits.rb', line 12 def where_not(**kwargs) self.class.new(self.reject {|benefit| kwargs.all? {|k,v| benefit_matches?(benefit, k, v) } }) end |