Class: Google::Apis::PartnersV2::Location

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
generated/google/apis/partners_v2/classes.rb,
generated/google/apis/partners_v2/representations.rb,
generated/google/apis/partners_v2/representations.rb

Overview

A location with address and geographic coordinates. May optionally contain a detailed (multi-field) version of the address.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Core::JsonObjectSupport

#to_json

Methods included from Core::Hashable

process_value, #to_h

Constructor Details

#initialize(**args) ⇒ Location

Returns a new instance of Location



1587
1588
1589
# File 'generated/google/apis/partners_v2/classes.rb', line 1587

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#addressString

The single string version of the address. Corresponds to the JSON property address

Returns:

  • (String)


1558
1559
1560
# File 'generated/google/apis/partners_v2/classes.rb', line 1558

def address
  @address
end

#address_lineArray<String>

The following address lines represent the most specific part of any address. Corresponds to the JSON property addressLine

Returns:

  • (Array<String>)


1502
1503
1504
# File 'generated/google/apis/partners_v2/classes.rb', line 1502

def address_line
  @address_line
end

#administrative_areaString

Top-level administrative subdivision of this country. Corresponds to the JSON property administrativeArea

Returns:

  • (String)


1512
1513
1514
# File 'generated/google/apis/partners_v2/classes.rb', line 1512

def administrative_area
  @administrative_area
end

#dependent_localityString

Dependent locality or sublocality. Used for UK dependent localities, or neighborhoods or boroughs in other locations. Corresponds to the JSON property dependentLocality

Returns:

  • (String)


1569
1570
1571
# File 'generated/google/apis/partners_v2/classes.rb', line 1569

def dependent_locality
  @dependent_locality
end

#language_codeString

Language code of the address. Should be in BCP 47 format. Corresponds to the JSON property languageCode

Returns:

  • (String)


1585
1586
1587
# File 'generated/google/apis/partners_v2/classes.rb', line 1585

def language_code
  @language_code
end

#lat_lngGoogle::Apis::PartnersV2::LatLng

An object representing a latitude/longitude pair. This is expressed as a pair of doubles representing degrees latitude and degrees longitude. Unless specified otherwise, this must conform to the WGS84 standard. Values must be within normalized ranges. Example of normalization code in Python: def NormalizeLongitude(longitude): """Wraps decimal degrees longitude to [-180.0, 180.0].""" q, r = divmod(longitude, 360.0) if r > 180.0 or (r == 180.0 and q <= -1.0): return r - 360.0 return r def NormalizeLatLng(latitude, longitude): """Wraps decimal degrees latitude and longitude to [-90.0, 90.0] and [-180.0, 180.0], respectively.""" r = latitude % 360.0 if r <= 90.0: return r, NormalizeLongitude(longitude) elif r >= 270.0: return r - 360, NormalizeLongitude(longitude) else: return 180 - r, NormalizeLongitude(longitude + 180.0) assert 180.0 == NormalizeLongitude(180.0) assert -180.0 == NormalizeLongitude(-180.0) assert -179.0 == NormalizeLongitude(181.0) assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0) assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0) assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0) assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0) assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0) assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0) assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0) assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0) assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0) assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0) The code in logs/storage/validator/logs_validator_traits.cc treats this type as if it were annotated as ST_LOCATION. Corresponds to the JSON property latLng



1553
1554
1555
# File 'generated/google/apis/partners_v2/classes.rb', line 1553

def lat_lng
  @lat_lng
end

#localityString

Generally refers to the city/town portion of an address. Corresponds to the JSON property locality

Returns:

  • (String)


1507
1508
1509
# File 'generated/google/apis/partners_v2/classes.rb', line 1507

def locality
  @locality
end

#postal_codeString

Values are frequently alphanumeric. Corresponds to the JSON property postalCode

Returns:

  • (String)


1574
1575
1576
# File 'generated/google/apis/partners_v2/classes.rb', line 1574

def postal_code
  @postal_code
end

#region_codeString

CLDR (Common Locale Data Repository) region code . Corresponds to the JSON property regionCode

Returns:

  • (String)


1563
1564
1565
# File 'generated/google/apis/partners_v2/classes.rb', line 1563

def region_code
  @region_code
end

#sorting_codeString

Use of this code is very country-specific, but will refer to a secondary classification code for sorting mail. Corresponds to the JSON property sortingCode

Returns:

  • (String)


1580
1581
1582
# File 'generated/google/apis/partners_v2/classes.rb', line 1580

def sorting_code
  @sorting_code
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
# File 'generated/google/apis/partners_v2/classes.rb', line 1592

def update!(**args)
  @address_line = args[:address_line] if args.key?(:address_line)
  @locality = args[:locality] if args.key?(:locality)
  @administrative_area = args[:administrative_area] if args.key?(:administrative_area)
  @lat_lng = args[:lat_lng] if args.key?(:lat_lng)
  @address = args[:address] if args.key?(:address)
  @region_code = args[:region_code] if args.key?(:region_code)
  @dependent_locality = args[:dependent_locality] if args.key?(:dependent_locality)
  @postal_code = args[:postal_code] if args.key?(:postal_code)
  @sorting_code = args[:sorting_code] if args.key?(:sorting_code)
  @language_code = args[:language_code] if args.key?(:language_code)
end