Class: GoogleMapsPlatform::BusinessStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/google_maps_platform/models/business_status.rb

Overview

Indicates the operational status of the place, if it is a business. If no data exists, business_status is not returned.

Constant Summary collapse

BUSINESS_STATUS =
[
  # TODO: Write general description for OPERATIONAL

  OPERATIONAL = 'OPERATIONAL'.freeze,

  # TODO: Write general description for CLOSED_TEMPORARILY

  CLOSED_TEMPORARILY = 'CLOSED_TEMPORARILY'.freeze,

  # TODO: Write general description for CLOSED_PERMANENTLY

  CLOSED_PERMANENTLY = 'CLOSED_PERMANENTLY'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = OPERATIONAL) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/google_maps_platform/models/business_status.rb', line 27

def self.from_value(value, default_value = OPERATIONAL)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'operational' then OPERATIONAL
  when 'closed_temporarily' then CLOSED_TEMPORARILY
  when 'closed_permanently' then CLOSED_PERMANENTLY
  else
    default_value
  end
end

.validate(value) ⇒ Object



21
22
23
24
25
# File 'lib/google_maps_platform/models/business_status.rb', line 21

def self.validate(value)
  return false if value.nil?

  BUSINESS_STATUS.include?(value)
end