Class: Airthings::LocationsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/airthings/api/locations_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ LocationsApi

Returns a new instance of LocationsApi.



19
20
21
# File 'lib/airthings/api/locations_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/airthings/api/locations_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#location_info(location_id, opts = {}) ⇒ GetLocationResponse

Get info about a specific Location

Parameters:

  • location_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :show_inactive (Boolean) — default: default to false
  • :organization_id (String)
  • :user_group_id (String)

Returns:



30
31
32
33
# File 'lib/airthings/api/locations_api.rb', line 30

def location_info(location_id, opts = {})
  data, _status_code, _headers = location_info_with_http_info(location_id, opts)
  data
end

#location_info_with_http_info(location_id, opts = {}) ⇒ Array<(GetLocationResponse, Integer, Hash)>

Get info about a specific Location

Parameters:

  • location_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :show_inactive (Boolean) — default: default to false
  • :organization_id (String)
  • :user_group_id (String)

Returns:

  • (Array<(GetLocationResponse, Integer, Hash)>)

    GetLocationResponse data, response status code and response headers



42
43
44
45
46
47
48
49
50
51
52
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
# File 'lib/airthings/api/locations_api.rb', line 42

def location_info_with_http_info(location_id, opts = {})
  @api_client.config.logger.debug "Calling API: LocationsApi.location_info ..." if @api_client.config.debugging
  # verify the required parameter 'location_id' is set
  if @api_client.config.client_side_validation && location_id.nil?
    raise ArgumentError, "Missing the required parameter 'location_id' when calling LocationsApi.location_info"
  end

  # resource path
  local_var_path = "/locations/{locationId}".sub("{locationId}", CGI.escape(location_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:showInactive] = opts[:show_inactive] unless opts[:show_inactive].nil?
  query_params[:organizationId] = opts[:organization_id] unless opts[:organization_id].nil?
  query_params[:userGroupId] = opts[:user_group_id] unless opts[:user_group_id].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params["Accept"] = @api_client.select_header_accept(["application/json"])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || "GetLocationResponse"

  # auth_names
  auth_names = opts[:debug_auth_names] || ["AirthingsAccounts"]

  new_options = opts.merge(
    operation: :"LocationsApi.location_info",
    header_params: header_params,
    query_params: query_params,
    form_params: form_params,
    body: post_body,
    auth_names: auth_names,
    return_type: return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LocationsApi#location_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

#locations_list(opts = {}) ⇒ GetLocationsResponse

Get all added Locations

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :organization_id (String)
  • :user_group_id (String)

Returns:



97
98
99
100
# File 'lib/airthings/api/locations_api.rb', line 97

def locations_list(opts = {})
  data, _status_code, _headers = locations_list_with_http_info(opts)
  data
end

#locations_list_with_http_info(opts = {}) ⇒ Array<(GetLocationsResponse, Integer, Hash)>

Get all added Locations

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :organization_id (String)
  • :user_group_id (String)

Returns:

  • (Array<(GetLocationsResponse, Integer, Hash)>)

    GetLocationsResponse data, response status code and response headers



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/airthings/api/locations_api.rb', line 107

def locations_list_with_http_info(opts = {})
  @api_client.config.logger.debug "Calling API: LocationsApi.locations_list ..." if @api_client.config.debugging
  # resource path
  local_var_path = "/locations"

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:organizationId] = opts[:organization_id] unless opts[:organization_id].nil?
  query_params[:userGroupId] = opts[:user_group_id] unless opts[:user_group_id].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params["Accept"] = @api_client.select_header_accept(["application/json"])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || "GetLocationsResponse"

  # auth_names
  auth_names = opts[:debug_auth_names] || ["AirthingsAccounts"]

  new_options = opts.merge(
    operation: :"LocationsApi.locations_list",
    header_params: header_params,
    query_params: query_params,
    form_params: form_params,
    body: post_body,
    auth_names: auth_names,
    return_type: return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LocationsApi#locations_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end