Class: EventDrivenServices::HhSearch::Schemas::RestaurantAvailabilitySchema

Inherits:
Object
  • Object
show all
Defined in:
app/services/event_driven_services/hh_search/schemas/restaurant_availability_schema.rb

Constant Summary collapse

VALID_EVENT_TYPES =
[
  EventDrivenClient::Constants::UPDATE_EVENT,
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(restaurant, event_type, changed_attributes) ⇒ RestaurantAvailabilitySchema

Returns a new instance of RestaurantAvailabilitySchema.



11
12
13
14
15
16
# File 'app/services/event_driven_services/hh_search/schemas/restaurant_availability_schema.rb', line 11

def initialize(restaurant, event_type, changed_attributes)
  @restaurant = restaurant
  @event_type = validate_event_type(event_type)
  @changed_attributes = changed_attributes
  @max_end_date = restaurant.determine_max_availability_date
end

Instance Attribute Details

#changed_attributesObject (readonly)

Returns the value of attribute changed_attributes.



5
6
7
# File 'app/services/event_driven_services/hh_search/schemas/restaurant_availability_schema.rb', line 5

def changed_attributes
  @changed_attributes
end

#event_typeObject (readonly)

Returns the value of attribute event_type.



5
6
7
# File 'app/services/event_driven_services/hh_search/schemas/restaurant_availability_schema.rb', line 5

def event_type
  @event_type
end

#max_end_dateObject (readonly)

Returns the value of attribute max_end_date.



5
6
7
# File 'app/services/event_driven_services/hh_search/schemas/restaurant_availability_schema.rb', line 5

def max_end_date
  @max_end_date
end

#restaurantObject (readonly)

Returns the value of attribute restaurant.



5
6
7
# File 'app/services/event_driven_services/hh_search/schemas/restaurant_availability_schema.rb', line 5

def restaurant
  @restaurant
end

Instance Method Details

#serializeHash

Serialize the restaurant tag to a hash

Returns:

  • (Hash)


21
22
23
# File 'app/services/event_driven_services/hh_search/schemas/restaurant_availability_schema.rb', line 21

def serialize
  availability
end

#serialize_as_jsonString

Serialize the restaurant tag to a JSON string

Returns:

  • (String)


28
29
30
# File 'app/services/event_driven_services/hh_search/schemas/restaurant_availability_schema.rb', line 28

def serialize_as_json
  serialize.to_json
end