Class: Samsara::Types::AddressResponseResponseBody

Inherits:
Object
  • Object
show all
Defined in:
lib/samsara_api/types/address_response_response_body.rb

Overview

Closest address that the GPS latitude and longitude match to.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(city: OMIT, country: OMIT, neighborhood: OMIT, point_of_interest: OMIT, postal_code: OMIT, state: OMIT, street: OMIT, street_number: OMIT, additional_properties: nil) ⇒ Samsara::Types::AddressResponseResponseBody

Parameters:

  • city (String) (defaults to: OMIT) —

    The name of the city

  • country (String) (defaults to: OMIT) —

    The country

  • neighborhood (String) (defaults to: OMIT) —

    The name of the neighborhood if one exists

  • point_of_interest (String) (defaults to: OMIT) —

    Point that may be of interest to the user

  • postal_code (String) (defaults to: OMIT) —

    The zip code

  • state (String) (defaults to: OMIT) —

    The name of the state

  • street (String) (defaults to: OMIT) —

    The street name

  • street_number (String) (defaults to: OMIT) —

    Street number of the address

  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/samsara_api/types/address_response_response_body.rb', line 43

def initialize(city: OMIT, country: OMIT, neighborhood: OMIT, point_of_interest: OMIT, postal_code: OMIT, state: OMIT, street: OMIT, street_number: OMIT, additional_properties: nil)
  @city = city if city != OMIT
  @country = country if country != OMIT
  @neighborhood = neighborhood if neighborhood != OMIT
  @point_of_interest = point_of_interest if point_of_interest != OMIT
  @postal_code = postal_code if postal_code != OMIT
  @state = state if state != OMIT
  @street = street if street != OMIT
  @street_number = street_number if street_number != OMIT
  @additional_properties = additional_properties
  @_field_set = { "city": city, "country": country, "neighborhood": neighborhood, "pointOfInterest": point_of_interest, "postalCode": postal_code, "state": state, "street": street, "streetNumber": street_number }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct) —

    Additional properties unmapped to the current class definition



26
27
28
# File 'lib/samsara_api/types/address_response_response_body.rb', line 26

def additional_properties
  @additional_properties
end

#city ⇒ String (readonly)

Returns The name of the city.

Returns:

  • (String) —

    The name of the city



10
11
12
# File 'lib/samsara_api/types/address_response_response_body.rb', line 10

def city
  @city
end

#country ⇒ String (readonly)

Returns The country.

Returns:

  • (String) —

    The country



12
13
14
# File 'lib/samsara_api/types/address_response_response_body.rb', line 12

def country
  @country
end

#neighborhood ⇒ String (readonly)

Returns The name of the neighborhood if one exists.

Returns:

  • (String) —

    The name of the neighborhood if one exists



14
15
16
# File 'lib/samsara_api/types/address_response_response_body.rb', line 14

def neighborhood
  @neighborhood
end

#point_of_interest ⇒ String (readonly)

Returns Point that may be of interest to the user.

Returns:

  • (String) —

    Point that may be of interest to the user



16
17
18
# File 'lib/samsara_api/types/address_response_response_body.rb', line 16

def point_of_interest
  @point_of_interest
end

#postal_code ⇒ String (readonly)

Returns The zip code.

Returns:

  • (String) —

    The zip code



18
19
20
# File 'lib/samsara_api/types/address_response_response_body.rb', line 18

def postal_code
  @postal_code
end

#state ⇒ String (readonly)

Returns The name of the state.

Returns:

  • (String) —

    The name of the state



20
21
22
# File 'lib/samsara_api/types/address_response_response_body.rb', line 20

def state
  @state
end

#street ⇒ String (readonly)

Returns The street name.

Returns:

  • (String) —

    The street name



22
23
24
# File 'lib/samsara_api/types/address_response_response_body.rb', line 22

def street
  @street
end

#street_number ⇒ String (readonly)

Returns Street number of the address.

Returns:

  • (String) —

    Street number of the address



24
25
26
# File 'lib/samsara_api/types/address_response_response_body.rb', line 24

def street_number
  @street_number
end

Class Method Details

.from_json(json_object:) ⇒ Samsara::Types::AddressResponseResponseBody

Parameters:

  • json_object (String)

Returns:



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/samsara_api/types/address_response_response_body.rb', line 61

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  city = parsed_json["city"]
  country = parsed_json["country"]
  neighborhood = parsed_json["neighborhood"]
  point_of_interest = parsed_json["pointOfInterest"]
  postal_code = parsed_json["postalCode"]
  state = parsed_json["state"]
  street = parsed_json["street"]
  street_number = parsed_json["streetNumber"]
  new(
    city: city,
    country: country,
    neighborhood: neighborhood,
    point_of_interest: point_of_interest,
    postal_code: postal_code,
    state: state,
    street: street,
    street_number: street_number,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


96
97
98
99
100
101
102
103
104
105
# File 'lib/samsara_api/types/address_response_response_body.rb', line 96

def self.validate_raw(obj:)
  obj.city&.is_a?(String) != false || raise("Passed value for field obj.city is not the expected type, validation failed.")
  obj.country&.is_a?(String) != false || raise("Passed value for field obj.country is not the expected type, validation failed.")
  obj.neighborhood&.is_a?(String) != false || raise("Passed value for field obj.neighborhood is not the expected type, validation failed.")
  obj.point_of_interest&.is_a?(String) != false || raise("Passed value for field obj.point_of_interest is not the expected type, validation failed.")
  obj.postal_code&.is_a?(String) != false || raise("Passed value for field obj.postal_code is not the expected type, validation failed.")
  obj.state&.is_a?(String) != false || raise("Passed value for field obj.state is not the expected type, validation failed.")
  obj.street&.is_a?(String) != false || raise("Passed value for field obj.street is not the expected type, validation failed.")
  obj.street_number&.is_a?(String) != false || raise("Passed value for field obj.street_number is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


87
88
89
# File 'lib/samsara_api/types/address_response_response_body.rb', line 87

def to_json
  @_field_set&.to_json
end