Class: Tarpon::Entity::Offerings

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/tarpon/entity/offerings.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(current_offering_id:, offerings:) ⇒ Offerings

Returns a new instance of Offerings.



12
13
14
15
16
17
# File 'lib/tarpon/entity/offerings.rb', line 12

def initialize(current_offering_id:, offerings:, **)
  @current_offering_id = current_offering_id
  @offerings = offerings.each_with_object({}) do |offering, map|
    map[offering[:identifier].to_sym] = Tarpon::Entity::Offering.new(**offering)
  end
end

Instance Attribute Details

#current_offering_idObject (readonly)

Returns the value of attribute current_offering_id.



10
11
12
# File 'lib/tarpon/entity/offerings.rb', line 10

def current_offering_id
  @current_offering_id
end

#offeringsObject (readonly)

Returns the value of attribute offerings.



10
11
12
# File 'lib/tarpon/entity/offerings.rb', line 10

def offerings
  @offerings
end

Instance Method Details

#[](identifier) ⇒ Object



23
24
25
# File 'lib/tarpon/entity/offerings.rb', line 23

def [](identifier)
  @offerings[identifier.to_sym]
end

#each(&block) ⇒ Object



19
20
21
# File 'lib/tarpon/entity/offerings.rb', line 19

def each(&block)
  @offerings.each(&block)
end