Class: Eaternet::Lives_1_0::Business

Inherits:
ValidatedObject show all
Defined in:
lib/eaternet/lives_1_0/business.rb

Overview

A food service establishment, e.g. a restaurant.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ValidatedObject

#check_validations!, #initialize

Constructor Details

This class inherits a constructor from Eaternet::ValidatedObject

Instance Attribute Details

#addressString

Street address of the business. For example: 706 Mission St. Required.

Returns:

  • (String)


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_idString

Unique identifier for the business. For many cities, this may be the license number. Required.

Returns:

  • (String)


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

#cityString

City of the business. This field must be included if the file contains businesses from multiple cities.

Returns:

  • (String)


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

#latitudeFloat

Latitude of the business. This field must be a valid WGS 84 latitude. For example: 37.7859547. Optional.

Returns:

  • (Float)


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

#longitudeFloat

Longitude of the business. This field must be a valid WGS 84 longitude. For example: -122.4024658. Optional.

Returns:

  • (Float)


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

#nameString

Common name of the business. Required.

Returns:

  • (String)


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_numberString

Phone number for a business including country specific dialing information. For example: +14159083801

Returns:

  • (String)


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_codeString

Zip code or other postal code. Optional.

Returns:

  • (String)


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

#stateString

State or province for the business. In the U.S. this should be the two-letter code for the state. Optional.

Returns:

  • (String)


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

Returns:

  • (Boolean)


93
94
95
# File 'lib/eaternet/lives_1_0/business.rb', line 93

def eql?(other)
  self == other
end

#hashObject



97
98
99
# File 'lib/eaternet/lives_1_0/business.rb', line 97

def hash
  business_id.hash
end

#to_sString

Returns:

  • (String)


102
103
104
# File 'lib/eaternet/lives_1_0/business.rb', line 102

def to_s
  "Business #{business_id}"
end