Class: Eaternet::Lives_1_0::Business
- Inherits:
-
ValidatedObject
- Object
- ValidatedObject
- Eaternet::Lives_1_0::Business
- Defined in:
- lib/eaternet/lives_1_0/business.rb
Overview
A food service establishment, e.g. a restaurant.
Instance Attribute Summary collapse
-
#address ⇒ String
Street address of the business.
-
#business_id ⇒ String
Unique identifier for the business.
-
#city ⇒ String
City of the business.
-
#latitude ⇒ Float
Latitude of the business.
-
#longitude ⇒ Float
Longitude of the business.
-
#name ⇒ String
Common name of the business.
-
#phone_number ⇒ String
Phone number for a business including country specific dialing information.
-
#postal_code ⇒ String
Zip code or other postal code.
-
#state ⇒ String
State or province for the business.
Instance Method Summary collapse
Methods inherited from ValidatedObject
#check_validations!, #initialize
Constructor Details
This class inherits a constructor from Eaternet::ValidatedObject
Instance Attribute Details
#address ⇒ String
Street address of the business. For example: 706 Mission St. Required.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/eaternet/lives_1_0/business.rb', line 53 class Business < ValidatedObject attr_accessor :business_id, :name, :address, :city, :state, :postal_code, :latitude, :longitude, :phone_number validates :business_id, :name, :address, type: String, presence: true validates :city, :state, :postal_code, :phone_number, type: String, allow_nil: true validates :latitude, numericality: { greater_than_or_equal_to: -90, less_than_or_equal_to: 90 }, allow_nil: true validates :longitude, numericality: { greater_than_or_equal_to: -180, less_than_or_equal_to: 180 }, allow_nil: true def latitude Float(@latitude) unless @latitude.nil? end def longitude Float(@longitude) unless @latitude.nil? end def ==(other) business_id == other.business_id end def eql?(other) self == other end def hash business_id.hash end # @return [String] def to_s "Business #{business_id}" end end |
#business_id ⇒ String
Unique identifier for the business. For many cities, this may be the license number. Required.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/eaternet/lives_1_0/business.rb', line 53 class Business < ValidatedObject attr_accessor :business_id, :name, :address, :city, :state, :postal_code, :latitude, :longitude, :phone_number validates :business_id, :name, :address, type: String, presence: true validates :city, :state, :postal_code, :phone_number, type: String, allow_nil: true validates :latitude, numericality: { greater_than_or_equal_to: -90, less_than_or_equal_to: 90 }, allow_nil: true validates :longitude, numericality: { greater_than_or_equal_to: -180, less_than_or_equal_to: 180 }, allow_nil: true def latitude Float(@latitude) unless @latitude.nil? end def longitude Float(@longitude) unless @latitude.nil? end def ==(other) business_id == other.business_id end def eql?(other) self == other end def hash business_id.hash end # @return [String] def to_s "Business #{business_id}" end end |
#city ⇒ String
City of the business. This field must be included if the file contains businesses from multiple cities.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/eaternet/lives_1_0/business.rb', line 53 class Business < ValidatedObject attr_accessor :business_id, :name, :address, :city, :state, :postal_code, :latitude, :longitude, :phone_number validates :business_id, :name, :address, type: String, presence: true validates :city, :state, :postal_code, :phone_number, type: String, allow_nil: true validates :latitude, numericality: { greater_than_or_equal_to: -90, less_than_or_equal_to: 90 }, allow_nil: true validates :longitude, numericality: { greater_than_or_equal_to: -180, less_than_or_equal_to: 180 }, allow_nil: true def latitude Float(@latitude) unless @latitude.nil? end def longitude Float(@longitude) unless @latitude.nil? end def ==(other) business_id == other.business_id end def eql?(other) self == other end def hash business_id.hash end # @return [String] def to_s "Business #{business_id}" end end |
#latitude ⇒ Float
Latitude of the business. This field must be a valid WGS 84 latitude. For example: 37.7859547. Optional.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/eaternet/lives_1_0/business.rb', line 53 class Business < ValidatedObject attr_accessor :business_id, :name, :address, :city, :state, :postal_code, :latitude, :longitude, :phone_number validates :business_id, :name, :address, type: String, presence: true validates :city, :state, :postal_code, :phone_number, type: String, allow_nil: true validates :latitude, numericality: { greater_than_or_equal_to: -90, less_than_or_equal_to: 90 }, allow_nil: true validates :longitude, numericality: { greater_than_or_equal_to: -180, less_than_or_equal_to: 180 }, allow_nil: true def latitude Float(@latitude) unless @latitude.nil? end def longitude Float(@longitude) unless @latitude.nil? end def ==(other) business_id == other.business_id end def eql?(other) self == other end def hash business_id.hash end # @return [String] def to_s "Business #{business_id}" end end |
#longitude ⇒ Float
Longitude of the business. This field must be a valid WGS 84 longitude. For example: -122.4024658. Optional.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/eaternet/lives_1_0/business.rb', line 53 class Business < ValidatedObject attr_accessor :business_id, :name, :address, :city, :state, :postal_code, :latitude, :longitude, :phone_number validates :business_id, :name, :address, type: String, presence: true validates :city, :state, :postal_code, :phone_number, type: String, allow_nil: true validates :latitude, numericality: { greater_than_or_equal_to: -90, less_than_or_equal_to: 90 }, allow_nil: true validates :longitude, numericality: { greater_than_or_equal_to: -180, less_than_or_equal_to: 180 }, allow_nil: true def latitude Float(@latitude) unless @latitude.nil? end def longitude Float(@longitude) unless @latitude.nil? end def ==(other) business_id == other.business_id end def eql?(other) self == other end def hash business_id.hash end # @return [String] def to_s "Business #{business_id}" end end |
#name ⇒ String
Common name of the business. Required.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/eaternet/lives_1_0/business.rb', line 53 class Business < ValidatedObject attr_accessor :business_id, :name, :address, :city, :state, :postal_code, :latitude, :longitude, :phone_number validates :business_id, :name, :address, type: String, presence: true validates :city, :state, :postal_code, :phone_number, type: String, allow_nil: true validates :latitude, numericality: { greater_than_or_equal_to: -90, less_than_or_equal_to: 90 }, allow_nil: true validates :longitude, numericality: { greater_than_or_equal_to: -180, less_than_or_equal_to: 180 }, allow_nil: true def latitude Float(@latitude) unless @latitude.nil? end def longitude Float(@longitude) unless @latitude.nil? end def ==(other) business_id == other.business_id end def eql?(other) self == other end def hash business_id.hash end # @return [String] def to_s "Business #{business_id}" end end |
#phone_number ⇒ String
Phone number for a business including country specific dialing information. For example: +14159083801
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/eaternet/lives_1_0/business.rb', line 53 class Business < ValidatedObject attr_accessor :business_id, :name, :address, :city, :state, :postal_code, :latitude, :longitude, :phone_number validates :business_id, :name, :address, type: String, presence: true validates :city, :state, :postal_code, :phone_number, type: String, allow_nil: true validates :latitude, numericality: { greater_than_or_equal_to: -90, less_than_or_equal_to: 90 }, allow_nil: true validates :longitude, numericality: { greater_than_or_equal_to: -180, less_than_or_equal_to: 180 }, allow_nil: true def latitude Float(@latitude) unless @latitude.nil? end def longitude Float(@longitude) unless @latitude.nil? end def ==(other) business_id == other.business_id end def eql?(other) self == other end def hash business_id.hash end # @return [String] def to_s "Business #{business_id}" end end |
#postal_code ⇒ String
Zip code or other postal code. Optional.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/eaternet/lives_1_0/business.rb', line 53 class Business < ValidatedObject attr_accessor :business_id, :name, :address, :city, :state, :postal_code, :latitude, :longitude, :phone_number validates :business_id, :name, :address, type: String, presence: true validates :city, :state, :postal_code, :phone_number, type: String, allow_nil: true validates :latitude, numericality: { greater_than_or_equal_to: -90, less_than_or_equal_to: 90 }, allow_nil: true validates :longitude, numericality: { greater_than_or_equal_to: -180, less_than_or_equal_to: 180 }, allow_nil: true def latitude Float(@latitude) unless @latitude.nil? end def longitude Float(@longitude) unless @latitude.nil? end def ==(other) business_id == other.business_id end def eql?(other) self == other end def hash business_id.hash end # @return [String] def to_s "Business #{business_id}" end end |
#state ⇒ String
State or province for the business. In the U.S. this should be the two-letter code for the state. Optional.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/eaternet/lives_1_0/business.rb', line 53 class Business < ValidatedObject attr_accessor :business_id, :name, :address, :city, :state, :postal_code, :latitude, :longitude, :phone_number validates :business_id, :name, :address, type: String, presence: true validates :city, :state, :postal_code, :phone_number, type: String, allow_nil: true validates :latitude, numericality: { greater_than_or_equal_to: -90, less_than_or_equal_to: 90 }, allow_nil: true validates :longitude, numericality: { greater_than_or_equal_to: -180, less_than_or_equal_to: 180 }, allow_nil: true def latitude Float(@latitude) unless @latitude.nil? end def longitude Float(@longitude) unless @latitude.nil? end def ==(other) business_id == other.business_id end def eql?(other) self == other end def hash business_id.hash end # @return [String] def to_s "Business #{business_id}" end end |
Instance Method Details
#==(other) ⇒ Object
89 90 91 |
# File 'lib/eaternet/lives_1_0/business.rb', line 89 def ==(other) business_id == other.business_id end |
#eql?(other) ⇒ Boolean
93 94 95 |
# File 'lib/eaternet/lives_1_0/business.rb', line 93 def eql?(other) self == other end |
#hash ⇒ Object
97 98 99 |
# File 'lib/eaternet/lives_1_0/business.rb', line 97 def hash business_id.hash end |
#to_s ⇒ String
102 103 104 |
# File 'lib/eaternet/lives_1_0/business.rb', line 102 def to_s "Business #{business_id}" end |