Class: GoogleMapsPlatform::Place
- Defined in:
- lib/google_maps_platform/models/place.rb
Overview
Attributes describing a place. Not all attributes will be available for all place types.
Instance Attribute Summary collapse
-
#address_components ⇒ Array[AddressComponent]
An array containing the separate components applicable to this address.
-
#adr_address ⇒ String
A representation of the place’s address in the [adr microformat](microformats.org/wiki/adr).
-
#business_status ⇒ BusinessStatus
Indicates the operational status of the place, if it is a business.
-
#curbside_pickup ⇒ TrueClass | FalseClass
Specifies if the business supports curbside pickup.
-
#current_opening_hours ⇒ PlaceOpeningHours
An object describing the opening hours of a place.
-
#delivery ⇒ TrueClass | FalseClass
Specifies if the business supports delivery.
-
#dine_in ⇒ TrueClass | FalseClass
Specifies if the business supports indoor or outdoor seating options.
-
#editorial_summary ⇒ PlaceEditorialSummary
Contains a summary of the place.
-
#formatted_address ⇒ String
A string containing the human-readable address of this place.
-
#formatted_phone_number ⇒ String
Contains the place’s phone number in its [local format](en.wikipedia.org/wiki/Local_conventions_for_writing_telepho ne_numbers).
-
#geometry ⇒ Geometry
An object describing the location.
-
#icon ⇒ String
Contains the URL of a suggested icon which may be displayed to the user when indicating this result on a map.
-
#icon_background_color ⇒ String
Contains the default HEX color code for the place’s category.
-
#icon_mask_base_uri ⇒ String
Contains the URL of a recommended icon, minus the
.svgor.pngfile type extension. -
#international_phone_number ⇒ String
Contains the place’s phone number in international format.
-
#name ⇒ String
Contains the human-readable name for the returned result.
-
#opening_hours ⇒ PlaceOpeningHours
An object describing the opening hours of a place.
-
#permanently_closed ⇒ TrueClass | FalseClass
Use
business_statusto get the operational status of businesses. -
#photos ⇒ Array[PlacePhoto]
An array of photo objects, each containing a reference to an image.
-
#place_id ⇒ String
A textual identifier that uniquely identifies a place.
-
#plus_code ⇒ PlusCode
An encoded location reference, derived from latitude and longitude coordinates, that represents an area, 1/8000th of a degree by 1/8000th of a degree (about 14m x 14m at the equator) or smaller.
-
#price_level ⇒ Float
The price level of the place, on a scale of 0 to 4.
-
#rating ⇒ Float
Contains the place’s rating, from 1.0 to 5.0, based on aggregated user reviews.
-
#reference ⇒ String
Contains the place’s rating, from 1.0 to 5.0, based on aggregated user reviews.
-
#reservable ⇒ TrueClass | FalseClass
Specifies if the place supports reservations.
-
#reviews ⇒ Array[PlaceReview]
A JSON array of up to five reviews.
-
#scope ⇒ String
Specifies if the place serves wine.
-
#secondary_opening_hours ⇒ Array[PlaceOpeningHours]
Contains an array of entries for the next seven days including information about secondary hours of a business.
-
#serves_beer ⇒ TrueClass | FalseClass
Specifies if the place serves beer.
-
#serves_breakfast ⇒ TrueClass | FalseClass
Specifies if the place serves breakfast.
-
#serves_brunch ⇒ TrueClass | FalseClass
Specifies if the place serves brunch.
-
#serves_dinner ⇒ TrueClass | FalseClass
Specifies if the place serves dinner.
-
#serves_lunch ⇒ TrueClass | FalseClass
Specifies if the place serves lunch.
-
#serves_vegetarian_food ⇒ TrueClass | FalseClass
Specifies if the place serves vegetarian food.
-
#serves_wine ⇒ TrueClass | FalseClass
Specifies if the place serves wine.
-
#takeout ⇒ TrueClass | FalseClass
Specifies if the business supports takeout.
-
#types ⇒ Array[String]
Contains an array of feature types describing the given result.
-
#url ⇒ String
Contains the URL of the official Google page for this place.
-
#user_ratings_total ⇒ Float
The total number of reviews, with or without text, for this place.
-
#utc_offset ⇒ Float
Contains the number of minutes this place’s current timezone is offset from UTC.
-
#vicinity ⇒ String
For establishment (‘types:[“establishment”, …])` results only, the
vicinityfield contains a simplified address for the place, including the street name, street number, and locality, but not the province/state, postal code, or country. -
#website ⇒ String
The authoritative website for this place, such as a business’ homepage.
-
#wheelchair_accessible_entrance ⇒ TrueClass | FalseClass
Specifies if the place has an entrance that is wheelchair-accessible.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(address_components: SKIP, adr_address: SKIP, business_status: SKIP, curbside_pickup: SKIP, current_opening_hours: SKIP, delivery: SKIP, dine_in: SKIP, editorial_summary: SKIP, formatted_address: SKIP, formatted_phone_number: SKIP, geometry: SKIP, icon: SKIP, icon_background_color: SKIP, icon_mask_base_uri: SKIP, international_phone_number: SKIP, name: SKIP, opening_hours: SKIP, permanently_closed: SKIP, photos: SKIP, place_id: SKIP, plus_code: SKIP, price_level: SKIP, rating: SKIP, reference: SKIP, reservable: SKIP, reviews: SKIP, serves_beer: SKIP, serves_breakfast: SKIP, serves_brunch: SKIP, serves_dinner: SKIP, serves_lunch: SKIP, serves_vegetarian_food: SKIP, serves_wine: SKIP, scope: SKIP, secondary_opening_hours: SKIP, takeout: SKIP, types: SKIP, url: SKIP, user_ratings_total: SKIP, utc_offset: SKIP, vicinity: SKIP, website: SKIP, wheelchair_accessible_entrance: SKIP, additional_properties: nil) ⇒ Place
constructor
A new instance of Place.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(address_components: SKIP, adr_address: SKIP, business_status: SKIP, curbside_pickup: SKIP, current_opening_hours: SKIP, delivery: SKIP, dine_in: SKIP, editorial_summary: SKIP, formatted_address: SKIP, formatted_phone_number: SKIP, geometry: SKIP, icon: SKIP, icon_background_color: SKIP, icon_mask_base_uri: SKIP, international_phone_number: SKIP, name: SKIP, opening_hours: SKIP, permanently_closed: SKIP, photos: SKIP, place_id: SKIP, plus_code: SKIP, price_level: SKIP, rating: SKIP, reference: SKIP, reservable: SKIP, reviews: SKIP, serves_beer: SKIP, serves_breakfast: SKIP, serves_brunch: SKIP, serves_dinner: SKIP, serves_lunch: SKIP, serves_vegetarian_food: SKIP, serves_wine: SKIP, scope: SKIP, secondary_opening_hours: SKIP, takeout: SKIP, types: SKIP, url: SKIP, user_ratings_total: SKIP, utc_offset: SKIP, vicinity: SKIP, website: SKIP, wheelchair_accessible_entrance: SKIP, additional_properties: nil) ⇒ Place
Returns a new instance of Place.
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
# File 'lib/google_maps_platform/models/place.rb', line 368 def initialize(address_components: SKIP, adr_address: SKIP, business_status: SKIP, curbside_pickup: SKIP, current_opening_hours: SKIP, delivery: SKIP, dine_in: SKIP, editorial_summary: SKIP, formatted_address: SKIP, formatted_phone_number: SKIP, geometry: SKIP, icon: SKIP, icon_background_color: SKIP, icon_mask_base_uri: SKIP, international_phone_number: SKIP, name: SKIP, opening_hours: SKIP, permanently_closed: SKIP, photos: SKIP, place_id: SKIP, plus_code: SKIP, price_level: SKIP, rating: SKIP, reference: SKIP, reservable: SKIP, reviews: SKIP, serves_beer: SKIP, serves_breakfast: SKIP, serves_brunch: SKIP, serves_dinner: SKIP, serves_lunch: SKIP, serves_vegetarian_food: SKIP, serves_wine: SKIP, scope: SKIP, secondary_opening_hours: SKIP, takeout: SKIP, types: SKIP, url: SKIP, user_ratings_total: SKIP, utc_offset: SKIP, vicinity: SKIP, website: SKIP, wheelchair_accessible_entrance: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @address_components = address_components unless address_components == SKIP @adr_address = adr_address unless adr_address == SKIP @business_status = business_status unless business_status == SKIP @curbside_pickup = curbside_pickup unless curbside_pickup == SKIP @current_opening_hours = current_opening_hours unless current_opening_hours == SKIP @delivery = delivery unless delivery == SKIP @dine_in = dine_in unless dine_in == SKIP @editorial_summary = editorial_summary unless editorial_summary == SKIP @formatted_address = formatted_address unless formatted_address == SKIP @formatted_phone_number = formatted_phone_number unless formatted_phone_number == SKIP @geometry = geometry unless geometry == SKIP @icon = icon unless icon == SKIP @icon_background_color = icon_background_color unless icon_background_color == SKIP @icon_mask_base_uri = icon_mask_base_uri unless icon_mask_base_uri == SKIP unless international_phone_number == SKIP @international_phone_number = international_phone_number end @name = name unless name == SKIP @opening_hours = opening_hours unless opening_hours == SKIP @permanently_closed = permanently_closed unless permanently_closed == SKIP @photos = photos unless photos == SKIP @place_id = place_id unless place_id == SKIP @plus_code = plus_code unless plus_code == SKIP @price_level = price_level unless price_level == SKIP = unless == SKIP @reference = reference unless reference == SKIP @reservable = reservable unless reservable == SKIP @reviews = reviews unless reviews == SKIP @serves_beer = serves_beer unless serves_beer == SKIP @serves_breakfast = serves_breakfast unless serves_breakfast == SKIP @serves_brunch = serves_brunch unless serves_brunch == SKIP @serves_dinner = serves_dinner unless serves_dinner == SKIP @serves_lunch = serves_lunch unless serves_lunch == SKIP @serves_vegetarian_food = serves_vegetarian_food unless serves_vegetarian_food == SKIP @serves_wine = serves_wine unless serves_wine == SKIP @scope = scope unless scope == SKIP @secondary_opening_hours = secondary_opening_hours unless secondary_opening_hours == SKIP @takeout = takeout unless takeout == SKIP @types = types unless types == SKIP @url = url unless url == SKIP = unless == SKIP @utc_offset = utc_offset unless utc_offset == SKIP @vicinity = vicinity unless vicinity == SKIP @website = website unless website == SKIP unless wheelchair_accessible_entrance == SKIP @wheelchair_accessible_entrance = wheelchair_accessible_entrance end @additional_properties = additional_properties end |
Instance Attribute Details
#address_components ⇒ Array[AddressComponent]
An array containing the separate components applicable to this address.
15 16 17 |
# File 'lib/google_maps_platform/models/place.rb', line 15 def address_components @address_components end |
#adr_address ⇒ String
A representation of the place’s address in the [adr microformat](microformats.org/wiki/adr).
20 21 22 |
# File 'lib/google_maps_platform/models/place.rb', line 20 def adr_address @adr_address end |
#business_status ⇒ BusinessStatus
Indicates the operational status of the place, if it is a business. If no data exists, business_status is not returned.
25 26 27 |
# File 'lib/google_maps_platform/models/place.rb', line 25 def business_status @business_status end |
#curbside_pickup ⇒ TrueClass | FalseClass
Specifies if the business supports curbside pickup.
29 30 31 |
# File 'lib/google_maps_platform/models/place.rb', line 29 def curbside_pickup @curbside_pickup end |
#current_opening_hours ⇒ PlaceOpeningHours
An object describing the opening hours of a place.
33 34 35 |
# File 'lib/google_maps_platform/models/place.rb', line 33 def current_opening_hours @current_opening_hours end |
#delivery ⇒ TrueClass | FalseClass
Specifies if the business supports delivery.
37 38 39 |
# File 'lib/google_maps_platform/models/place.rb', line 37 def delivery @delivery end |
#dine_in ⇒ TrueClass | FalseClass
Specifies if the business supports indoor or outdoor seating options.
41 42 43 |
# File 'lib/google_maps_platform/models/place.rb', line 41 def dine_in @dine_in end |
#editorial_summary ⇒ PlaceEditorialSummary
Contains a summary of the place. A summary is comprised of a textual overview, and also includes the language code for these if applicable. Summary text must be presented as-is and can not be modified or altered.
47 48 49 |
# File 'lib/google_maps_platform/models/place.rb', line 47 def editorial_summary @editorial_summary end |
#formatted_address ⇒ String
A string containing the human-readable address of this place. Often this address is equivalent to the postal address. Note that some countries, such as the United Kingdom, do not allow distribution of true postal addresses due to licensing restrictions. The formatted address is logically composed of one or more address components. For example, the address “111 8th Avenue, New York, NY” consists of the following components: “111” (the street number), “8th Avenue” (the route), “New York” (the city) and “NY” (the US state). Do not parse the formatted address programmatically. Instead you should use the individual address components, which the API response includes in addition to the formatted address field.
61 62 63 |
# File 'lib/google_maps_platform/models/place.rb', line 61 def formatted_address @formatted_address end |
#formatted_phone_number ⇒ String
Contains the place’s phone number in its [local format](en.wikipedia.org/wiki/Local_conventions_for_writing_telepho ne_numbers).
67 68 69 |
# File 'lib/google_maps_platform/models/place.rb', line 67 def formatted_phone_number @formatted_phone_number end |
#geometry ⇒ Geometry
An object describing the location.
71 72 73 |
# File 'lib/google_maps_platform/models/place.rb', line 71 def geometry @geometry end |
#icon ⇒ String
Contains the URL of a suggested icon which may be displayed to the user when indicating this result on a map.
76 77 78 |
# File 'lib/google_maps_platform/models/place.rb', line 76 def icon @icon end |
#icon_background_color ⇒ String
Contains the default HEX color code for the place’s category.
80 81 82 |
# File 'lib/google_maps_platform/models/place.rb', line 80 def icon_background_color @icon_background_color end |
#icon_mask_base_uri ⇒ String
Contains the URL of a recommended icon, minus the .svg or .png file type extension.
85 86 87 |
# File 'lib/google_maps_platform/models/place.rb', line 85 def icon_mask_base_uri @icon_mask_base_uri end |
#international_phone_number ⇒ String
Contains the place’s phone number in international format. International format includes the country code, and is prefixed with the plus, , sign. For example, the international_phone_number for Google’s Sydney, Australia office is ‘61 2 9374 4000`.
92 93 94 |
# File 'lib/google_maps_platform/models/place.rb', line 92 def international_phone_number @international_phone_number end |
#name ⇒ String
Contains the human-readable name for the returned result. For establishment results, this is usually the canonicalized business name.
97 98 99 |
# File 'lib/google_maps_platform/models/place.rb', line 97 def name @name end |
#opening_hours ⇒ PlaceOpeningHours
An object describing the opening hours of a place.
101 102 103 |
# File 'lib/google_maps_platform/models/place.rb', line 101 def opening_hours @opening_hours end |
#permanently_closed ⇒ TrueClass | FalseClass
Use business_status to get the operational status of businesses.
105 106 107 |
# File 'lib/google_maps_platform/models/place.rb', line 105 def permanently_closed @permanently_closed end |
#photos ⇒ Array[PlacePhoto]
An array of photo objects, each containing a reference to an image. A request may return up to ten photos. More information about place photos and how you can use the images in your application can be found in the [Place Photos](developers.google.com/maps/documentation/places/web-servic e/photos) documentation.
114 115 116 |
# File 'lib/google_maps_platform/models/place.rb', line 114 def photos @photos end |
#place_id ⇒ String
A textual identifier that uniquely identifies a place. To retrieve information about the place, pass this identifier in the place_id field of a Places API request. For more information about place IDs, see the [place ID overview](developers.google.com/maps/documentation/places/web-serv ice/place-id).
123 124 125 |
# File 'lib/google_maps_platform/models/place.rb', line 123 def place_id @place_id end |
#plus_code ⇒ PlusCode
An encoded location reference, derived from latitude and longitude coordinates, that represents an area, 1/8000th of a degree by 1/8000th of a degree (about 14m x 14m at the equator) or smaller. Plus codes can be used as a replacement for street addresses in places where they do not exist (where buildings are not numbered or streets are not named).
131 132 133 |
# File 'lib/google_maps_platform/models/place.rb', line 131 def plus_code @plus_code end |
#price_level ⇒ Float
The price level of the place, on a scale of 0 to 4. The exact amount indicated by a specific value will vary from region to region. Price levels are interpreted as follows:
-
0 Free
-
1 Inexpensive
-
2 Moderate
-
3 Expensive
-
4 Very Expensive
142 143 144 |
# File 'lib/google_maps_platform/models/place.rb', line 142 def price_level @price_level end |
#rating ⇒ Float
Contains the place’s rating, from 1.0 to 5.0, based on aggregated user reviews.
147 148 149 |
# File 'lib/google_maps_platform/models/place.rb', line 147 def end |
#reference ⇒ String
Contains the place’s rating, from 1.0 to 5.0, based on aggregated user reviews.
152 153 154 |
# File 'lib/google_maps_platform/models/place.rb', line 152 def reference @reference end |
#reservable ⇒ TrueClass | FalseClass
Specifies if the place supports reservations.
156 157 158 |
# File 'lib/google_maps_platform/models/place.rb', line 156 def reservable @reservable end |
#reviews ⇒ Array[PlaceReview]
A JSON array of up to five reviews. By default, the reviews are sorted in order of relevance. Use the reviews_sort request parameter to control sorting.
-
For
most_relevant(default), reviews are sorted by relevance; the
service will bias the results to return reviews originally written in the preferred language.
-
For
newest, reviews are sorted in chronological order; the preferred
language does not affect the sort order. Google recommends indicating to users whether results are ordered by most_relevant or newest.
169 170 171 |
# File 'lib/google_maps_platform/models/place.rb', line 169 def reviews @reviews end |
#scope ⇒ String
Specifies if the place serves wine.
201 202 203 |
# File 'lib/google_maps_platform/models/place.rb', line 201 def scope @scope end |
#secondary_opening_hours ⇒ Array[PlaceOpeningHours]
Contains an array of entries for the next seven days including information about secondary hours of a business. Secondary hours are different from a business’s main hours. For example, a restaurant can specify drive through hours or delivery hours as its secondary hours. This field populates the type subfield, which draws from a predefined list of opening hours types (such as DRIVE_THROUGH, PICKUP, or TAKEOUT) based on the types of the place. This field includes the special_days subfield of all hours, set for dates that have exceptional hours.
212 213 214 |
# File 'lib/google_maps_platform/models/place.rb', line 212 def secondary_opening_hours @secondary_opening_hours end |
#serves_beer ⇒ TrueClass | FalseClass
Specifies if the place serves beer.
173 174 175 |
# File 'lib/google_maps_platform/models/place.rb', line 173 def serves_beer @serves_beer end |
#serves_breakfast ⇒ TrueClass | FalseClass
Specifies if the place serves breakfast.
177 178 179 |
# File 'lib/google_maps_platform/models/place.rb', line 177 def serves_breakfast @serves_breakfast end |
#serves_brunch ⇒ TrueClass | FalseClass
Specifies if the place serves brunch.
181 182 183 |
# File 'lib/google_maps_platform/models/place.rb', line 181 def serves_brunch @serves_brunch end |
#serves_dinner ⇒ TrueClass | FalseClass
Specifies if the place serves dinner.
185 186 187 |
# File 'lib/google_maps_platform/models/place.rb', line 185 def serves_dinner @serves_dinner end |
#serves_lunch ⇒ TrueClass | FalseClass
Specifies if the place serves lunch.
189 190 191 |
# File 'lib/google_maps_platform/models/place.rb', line 189 def serves_lunch @serves_lunch end |
#serves_vegetarian_food ⇒ TrueClass | FalseClass
Specifies if the place serves vegetarian food.
193 194 195 |
# File 'lib/google_maps_platform/models/place.rb', line 193 def serves_vegetarian_food @serves_vegetarian_food end |
#serves_wine ⇒ TrueClass | FalseClass
Specifies if the place serves wine.
197 198 199 |
# File 'lib/google_maps_platform/models/place.rb', line 197 def serves_wine @serves_wine end |
#takeout ⇒ TrueClass | FalseClass
Specifies if the business supports takeout.
216 217 218 |
# File 'lib/google_maps_platform/models/place.rb', line 216 def takeout @takeout end |
#types ⇒ Array[String]
Contains an array of feature types describing the given result. See the list of [supported types](developers.google.com/maps/documentation/places/web-service /supported_types#table2).
223 224 225 |
# File 'lib/google_maps_platform/models/place.rb', line 223 def types @types end |
#url ⇒ String
Contains the URL of the official Google page for this place. This will be the Google-owned page that contains the best available information about the place. Applications must link to or embed this page on any screen that shows detailed results about the place to the user.
230 231 232 |
# File 'lib/google_maps_platform/models/place.rb', line 230 def url @url end |
#user_ratings_total ⇒ Float
The total number of reviews, with or without text, for this place.
234 235 236 |
# File 'lib/google_maps_platform/models/place.rb', line 234 def end |
#utc_offset ⇒ Float
Contains the number of minutes this place’s current timezone is offset from UTC. For example, for places in Sydney, Australia during daylight saving time this would be 660 (+11 hours from UTC), and for places in California outside of daylight saving time this would be -480 (-8 hours from UTC).
242 243 244 |
# File 'lib/google_maps_platform/models/place.rb', line 242 def utc_offset @utc_offset end |
#vicinity ⇒ String
For establishment (‘types:[“establishment”, …])` results only, the vicinity field contains a simplified address for the place, including the street name, street number, and locality, but not the province/state, postal code, or country. For all other results, the vicinity field contains the name of the narrowest political (`types:[“political”, …]`) feature that is present in the address of the result. This content is meant to be read as-is. Do not programmatically parse the formatted address.
254 255 256 |
# File 'lib/google_maps_platform/models/place.rb', line 254 def vicinity @vicinity end |
#website ⇒ String
The authoritative website for this place, such as a business’ homepage.
258 259 260 |
# File 'lib/google_maps_platform/models/place.rb', line 258 def website @website end |
#wheelchair_accessible_entrance ⇒ TrueClass | FalseClass
Specifies if the place has an entrance that is wheelchair-accessible.
262 263 264 |
# File 'lib/google_maps_platform/models/place.rb', line 262 def wheelchair_accessible_entrance @wheelchair_accessible_entrance end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 |
# File 'lib/google_maps_platform/models/place.rb', line 442 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it address_components = nil unless hash['address_components'].nil? address_components = [] hash['address_components'].each do |structure| address_components << (AddressComponent.from_hash(structure) if structure) end end address_components = SKIP unless hash.key?('address_components') adr_address = hash.key?('adr_address') ? hash['adr_address'] : SKIP business_status = hash.key?('business_status') ? hash['business_status'] : SKIP curbside_pickup = hash.key?('curbside_pickup') ? hash['curbside_pickup'] : SKIP current_opening_hours = PlaceOpeningHours.from_hash(hash['current_opening_hours']) if hash['current_opening_hours'] delivery = hash.key?('delivery') ? hash['delivery'] : SKIP dine_in = hash.key?('dine_in') ? hash['dine_in'] : SKIP editorial_summary = PlaceEditorialSummary.from_hash(hash['editorial_summary']) if hash['editorial_summary'] formatted_address = hash.key?('formatted_address') ? hash['formatted_address'] : SKIP formatted_phone_number = hash.key?('formatted_phone_number') ? hash['formatted_phone_number'] : SKIP geometry = Geometry.from_hash(hash['geometry']) if hash['geometry'] icon = hash.key?('icon') ? hash['icon'] : SKIP icon_background_color = hash.key?('icon_background_color') ? hash['icon_background_color'] : SKIP icon_mask_base_uri = hash.key?('icon_mask_base_uri') ? hash['icon_mask_base_uri'] : SKIP international_phone_number = hash.key?('international_phone_number') ? hash['international_phone_number'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP opening_hours = PlaceOpeningHours.from_hash(hash['opening_hours']) if hash['opening_hours'] permanently_closed = hash.key?('permanently_closed') ? hash['permanently_closed'] : SKIP # Parameter is an array, so we need to iterate through it photos = nil unless hash['photos'].nil? photos = [] hash['photos'].each do |structure| photos << (PlacePhoto.from_hash(structure) if structure) end end photos = SKIP unless hash.key?('photos') place_id = hash.key?('place_id') ? hash['place_id'] : SKIP plus_code = PlusCode.from_hash(hash['plus_code']) if hash['plus_code'] price_level = hash.key?('price_level') ? hash['price_level'] : SKIP = hash.key?('rating') ? hash['rating'] : SKIP reference = hash.key?('reference') ? hash['reference'] : SKIP reservable = hash.key?('reservable') ? hash['reservable'] : SKIP # Parameter is an array, so we need to iterate through it reviews = nil unless hash['reviews'].nil? reviews = [] hash['reviews'].each do |structure| reviews << (PlaceReview.from_hash(structure) if structure) end end reviews = SKIP unless hash.key?('reviews') serves_beer = hash.key?('serves_beer') ? hash['serves_beer'] : SKIP serves_breakfast = hash.key?('serves_breakfast') ? hash['serves_breakfast'] : SKIP serves_brunch = hash.key?('serves_brunch') ? hash['serves_brunch'] : SKIP serves_dinner = hash.key?('serves_dinner') ? hash['serves_dinner'] : SKIP serves_lunch = hash.key?('serves_lunch') ? hash['serves_lunch'] : SKIP serves_vegetarian_food = hash.key?('serves_vegetarian_food') ? hash['serves_vegetarian_food'] : SKIP serves_wine = hash.key?('serves_wine') ? hash['serves_wine'] : SKIP scope = hash.key?('scope') ? hash['scope'] : SKIP # Parameter is an array, so we need to iterate through it secondary_opening_hours = nil unless hash['secondary_opening_hours'].nil? secondary_opening_hours = [] hash['secondary_opening_hours'].each do |structure| secondary_opening_hours << (PlaceOpeningHours.from_hash(structure) if structure) end end secondary_opening_hours = SKIP unless hash.key?('secondary_opening_hours') takeout = hash.key?('takeout') ? hash['takeout'] : SKIP types = hash.key?('types') ? hash['types'] : SKIP url = hash.key?('url') ? hash['url'] : SKIP = hash.key?('user_ratings_total') ? hash['user_ratings_total'] : SKIP utc_offset = hash.key?('utc_offset') ? hash['utc_offset'] : SKIP vicinity = hash.key?('vicinity') ? hash['vicinity'] : SKIP website = hash.key?('website') ? hash['website'] : SKIP wheelchair_accessible_entrance = hash.key?('wheelchair_accessible_entrance') ? hash['wheelchair_accessible_entrance'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. Place.new(address_components: address_components, adr_address: adr_address, business_status: business_status, curbside_pickup: curbside_pickup, current_opening_hours: current_opening_hours, delivery: delivery, dine_in: dine_in, editorial_summary: editorial_summary, formatted_address: formatted_address, formatted_phone_number: formatted_phone_number, geometry: geometry, icon: icon, icon_background_color: icon_background_color, icon_mask_base_uri: icon_mask_base_uri, international_phone_number: international_phone_number, name: name, opening_hours: opening_hours, permanently_closed: permanently_closed, photos: photos, place_id: place_id, plus_code: plus_code, price_level: price_level, rating: , reference: reference, reservable: reservable, reviews: reviews, serves_beer: serves_beer, serves_breakfast: serves_breakfast, serves_brunch: serves_brunch, serves_dinner: serves_dinner, serves_lunch: serves_lunch, serves_vegetarian_food: serves_vegetarian_food, serves_wine: serves_wine, scope: scope, secondary_opening_hours: secondary_opening_hours, takeout: takeout, types: types, url: url, user_ratings_total: , utc_offset: utc_offset, vicinity: vicinity, website: website, wheelchair_accessible_entrance: wheelchair_accessible_entrance, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
# File 'lib/google_maps_platform/models/place.rb', line 265 def self.names @_hash = {} if @_hash.nil? @_hash['address_components'] = 'address_components' @_hash['adr_address'] = 'adr_address' @_hash['business_status'] = 'business_status' @_hash['curbside_pickup'] = 'curbside_pickup' @_hash['current_opening_hours'] = 'current_opening_hours' @_hash['delivery'] = 'delivery' @_hash['dine_in'] = 'dine_in' @_hash['editorial_summary'] = 'editorial_summary' @_hash['formatted_address'] = 'formatted_address' @_hash['formatted_phone_number'] = 'formatted_phone_number' @_hash['geometry'] = 'geometry' @_hash['icon'] = 'icon' @_hash['icon_background_color'] = 'icon_background_color' @_hash['icon_mask_base_uri'] = 'icon_mask_base_uri' @_hash['international_phone_number'] = 'international_phone_number' @_hash['name'] = 'name' @_hash['opening_hours'] = 'opening_hours' @_hash['permanently_closed'] = 'permanently_closed' @_hash['photos'] = 'photos' @_hash['place_id'] = 'place_id' @_hash['plus_code'] = 'plus_code' @_hash['price_level'] = 'price_level' @_hash['rating'] = 'rating' @_hash['reference'] = 'reference' @_hash['reservable'] = 'reservable' @_hash['reviews'] = 'reviews' @_hash['serves_beer'] = 'serves_beer' @_hash['serves_breakfast'] = 'serves_breakfast' @_hash['serves_brunch'] = 'serves_brunch' @_hash['serves_dinner'] = 'serves_dinner' @_hash['serves_lunch'] = 'serves_lunch' @_hash['serves_vegetarian_food'] = 'serves_vegetarian_food' @_hash['serves_wine'] = 'serves_wine' @_hash['scope'] = 'scope' @_hash['secondary_opening_hours'] = 'secondary_opening_hours' @_hash['takeout'] = 'takeout' @_hash['types'] = 'types' @_hash['url'] = 'url' @_hash['user_ratings_total'] = 'user_ratings_total' @_hash['utc_offset'] = 'utc_offset' @_hash['vicinity'] = 'vicinity' @_hash['website'] = 'website' @_hash['wheelchair_accessible_entrance'] = 'wheelchair_accessible_entrance' @_hash end |
.nullables ⇒ Object
An array for nullable fields
364 365 366 |
# File 'lib/google_maps_platform/models/place.rb', line 364 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
# File 'lib/google_maps_platform/models/place.rb', line 315 def self.optionals %w[ address_components adr_address business_status curbside_pickup current_opening_hours delivery dine_in editorial_summary formatted_address formatted_phone_number geometry icon icon_background_color icon_mask_base_uri international_phone_number name opening_hours permanently_closed photos place_id plus_code price_level rating reference reservable reviews serves_beer serves_breakfast serves_brunch serves_dinner serves_lunch serves_vegetarian_food serves_wine scope secondary_opening_hours takeout types url user_ratings_total utc_offset vicinity website wheelchair_accessible_entrance ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 |
# File 'lib/google_maps_platform/models/place.rb', line 619 def inspect class_name = self.class.name.split('::').last "<#{class_name} address_components: #{@address_components.inspect}, adr_address:"\ " #{@adr_address.inspect}, business_status: #{@business_status.inspect}, curbside_pickup:"\ " #{@curbside_pickup.inspect}, current_opening_hours: #{@current_opening_hours.inspect},"\ " delivery: #{@delivery.inspect}, dine_in: #{@dine_in.inspect}, editorial_summary:"\ " #{@editorial_summary.inspect}, formatted_address: #{@formatted_address.inspect},"\ " formatted_phone_number: #{@formatted_phone_number.inspect}, geometry:"\ " #{@geometry.inspect}, icon: #{@icon.inspect}, icon_background_color:"\ " #{@icon_background_color.inspect}, icon_mask_base_uri: #{@icon_mask_base_uri.inspect},"\ " international_phone_number: #{@international_phone_number.inspect}, name:"\ " #{@name.inspect}, opening_hours: #{@opening_hours.inspect}, permanently_closed:"\ " #{@permanently_closed.inspect}, photos: #{@photos.inspect}, place_id:"\ " #{@place_id.inspect}, plus_code: #{@plus_code.inspect}, price_level:"\ " #{@price_level.inspect}, rating: #{@rating.inspect}, reference: #{@reference.inspect},"\ " reservable: #{@reservable.inspect}, reviews: #{@reviews.inspect}, serves_beer:"\ " #{@serves_beer.inspect}, serves_breakfast: #{@serves_breakfast.inspect}, serves_brunch:"\ " #{@serves_brunch.inspect}, serves_dinner: #{@serves_dinner.inspect}, serves_lunch:"\ " #{@serves_lunch.inspect}, serves_vegetarian_food: #{@serves_vegetarian_food.inspect},"\ " serves_wine: #{@serves_wine.inspect}, scope: #{@scope.inspect}, secondary_opening_hours:"\ " #{@secondary_opening_hours.inspect}, takeout: #{@takeout.inspect}, types:"\ " #{@types.inspect}, url: #{@url.inspect}, user_ratings_total:"\ " #{@user_ratings_total.inspect}, utc_offset: #{@utc_offset.inspect}, vicinity:"\ " #{@vicinity.inspect}, website: #{@website.inspect}, wheelchair_accessible_entrance:"\ " #{@wheelchair_accessible_entrance.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 |
# File 'lib/google_maps_platform/models/place.rb', line 595 def to_s class_name = self.class.name.split('::').last "<#{class_name} address_components: #{@address_components}, adr_address: #{@adr_address},"\ " business_status: #{@business_status}, curbside_pickup: #{@curbside_pickup},"\ " current_opening_hours: #{@current_opening_hours}, delivery: #{@delivery}, dine_in:"\ " #{@dine_in}, editorial_summary: #{@editorial_summary}, formatted_address:"\ " #{@formatted_address}, formatted_phone_number: #{@formatted_phone_number}, geometry:"\ " #{@geometry}, icon: #{@icon}, icon_background_color: #{@icon_background_color},"\ " icon_mask_base_uri: #{@icon_mask_base_uri}, international_phone_number:"\ " #{@international_phone_number}, name: #{@name}, opening_hours: #{@opening_hours},"\ " permanently_closed: #{@permanently_closed}, photos: #{@photos}, place_id: #{@place_id},"\ " plus_code: #{@plus_code}, price_level: #{@price_level}, rating: #{@rating}, reference:"\ " #{@reference}, reservable: #{@reservable}, reviews: #{@reviews}, serves_beer:"\ " #{@serves_beer}, serves_breakfast: #{@serves_breakfast}, serves_brunch: #{@serves_brunch},"\ " serves_dinner: #{@serves_dinner}, serves_lunch: #{@serves_lunch}, serves_vegetarian_food:"\ " #{@serves_vegetarian_food}, serves_wine: #{@serves_wine}, scope: #{@scope},"\ " secondary_opening_hours: #{@secondary_opening_hours}, takeout: #{@takeout}, types:"\ " #{@types}, url: #{@url}, user_ratings_total: #{@user_ratings_total}, utc_offset:"\ " #{@utc_offset}, vicinity: #{@vicinity}, website: #{@website},"\ " wheelchair_accessible_entrance: #{@wheelchair_accessible_entrance}, additional_properties:"\ " #{@additional_properties}>" end |