Class: Intrinio::MunicipalityApi

Inherits:
Object
  • Object
show all
Defined in:
lib/intrinio-sdk/api/municipality_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ MunicipalityApi

Returns a new instance of MunicipalityApi.



19
20
21
# File 'lib/intrinio-sdk/api/municipality_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/intrinio-sdk/api/municipality_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_all_municipalities(opts = {}) ⇒ ApiResponseMunicipalities

All Municipalities

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :has_financials (BOOLEAN)

    Return municipalities with financials

  • :government_name (String)

    Return municipalities with a government name matching the given query

  • :government_type (String)

    Return municipalities with the given government type

  • :area_name (String)

    Return municipalities with an area name matching the given query

  • :area_type (String)

    Return municipalities with the given area type

  • :city (String)

    Return municipalities in the given city

  • :state (String)

    Return municipalities in the given state

  • :zipcode (Float)

    Return municipalities in the given zipcode

  • :population_greater_than (Float)

    Return municipalities with a population greater than the given number

  • :population_less_than (Float)

    Return municipalities with a population less than the given number

  • :enrollment_greater_than (Float)

    Return municipalities with an enrollment greater than the given number

  • :enrollment_less_than (Float)

    Return municipalities with an enrollment less than the given number

  • :next_page (String)

    Gets the next page of data from a previous API call

Returns:



40
41
42
43
# File 'lib/intrinio-sdk/api/municipality_api.rb', line 40

def get_all_municipalities(opts = {})
  data, _status_code, _headers = get_all_municipalities_with_http_info(opts)
  return data
end

#get_all_municipalities_with_http_info(opts = {}) ⇒ Array<(ApiResponseMunicipalities, Fixnum, Hash)>

All Municipalities

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :has_financials (BOOLEAN)

    Return municipalities with financials

  • :government_name (String)

    Return municipalities with a government name matching the given query

  • :government_type (String)

    Return municipalities with the given government type

  • :area_name (String)

    Return municipalities with an area name matching the given query

  • :area_type (String)

    Return municipalities with the given area type

  • :city (String)

    Return municipalities in the given city

  • :state (String)

    Return municipalities in the given state

  • :zipcode (Float)

    Return municipalities in the given zipcode

  • :population_greater_than (Float)

    Return municipalities with a population greater than the given number

  • :population_less_than (Float)

    Return municipalities with a population less than the given number

  • :enrollment_greater_than (Float)

    Return municipalities with an enrollment greater than the given number

  • :enrollment_less_than (Float)

    Return municipalities with an enrollment less than the given number

  • :next_page (String)

    Gets the next page of data from a previous API call

Returns:

  • (Array<(ApiResponseMunicipalities, Fixnum, Hash)>)

    ApiResponseMunicipalities data, response status code and response headers



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
106
107
108
109
110
# File 'lib/intrinio-sdk/api/municipality_api.rb', line 62

def get_all_municipalities_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MunicipalityApi.get_all_municipalities ..."
  end
  if @api_client.config.client_side_validation && opts[:'area_type'] && !['Borough', 'Census Borough', 'Census County', 'Census Division', 'Census Parish', 'City', 'City And County', 'County', 'Municipality', 'Parish'].include?(opts[:'area_type'])
    fail ArgumentError, 'invalid value for "area_type", must be one of Borough, Census Borough, Census County, Census Division, Census Parish, City, City And County, County, Municipality, Parish'
  end
  # resource path
  local_var_path = "/municipalities"

  # query parameters
  query_params = {}
  query_params[:'has_financials'] = opts[:'has_financials'] if !opts[:'has_financials'].nil?
  query_params[:'government_name'] = opts[:'government_name'] if !opts[:'government_name'].nil?
  query_params[:'government_type'] = opts[:'government_type'] if !opts[:'government_type'].nil?
  query_params[:'area_name'] = opts[:'area_name'] if !opts[:'area_name'].nil?
  query_params[:'area_type'] = opts[:'area_type'] if !opts[:'area_type'].nil?
  query_params[:'city'] = opts[:'city'] if !opts[:'city'].nil?
  query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?
  query_params[:'zipcode'] = opts[:'zipcode'] if !opts[:'zipcode'].nil?
  query_params[:'population_greater_than'] = opts[:'population_greater_than'] if !opts[:'population_greater_than'].nil?
  query_params[:'population_less_than'] = opts[:'population_less_than'] if !opts[:'population_less_than'].nil?
  query_params[:'enrollment_greater_than'] = opts[:'enrollment_greater_than'] if !opts[:'enrollment_greater_than'].nil?
  query_params[:'enrollment_less_than'] = opts[:'enrollment_less_than'] if !opts[:'enrollment_less_than'].nil?
  query_params[:'next_page'] = opts[:'next_page'] if !opts[:'next_page'].nil?

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ApiResponseMunicipalities')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MunicipalityApi#get_all_municipalities\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_municipality_by_id(id, opts = {}) ⇒ Municipality

Municipality by ID Returns the Municipality with the given ID

Parameters:

  • id

    An Intrinio ID of a Municipality

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

    the optional parameters

Returns:



117
118
119
120
# File 'lib/intrinio-sdk/api/municipality_api.rb', line 117

def get_municipality_by_id(id, opts = {})
  data, _status_code, _headers = get_municipality_by_id_with_http_info(id, opts)
  return data
end

#get_municipality_by_id_with_http_info(id, opts = {}) ⇒ Array<(Municipality, Fixnum, Hash)>

Municipality by ID Returns the Municipality with the given ID

Parameters:

  • id

    An Intrinio ID of a Municipality

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

    the optional parameters

Returns:

  • (Array<(Municipality, Fixnum, Hash)>)

    Municipality data, response status code and response headers



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/intrinio-sdk/api/municipality_api.rb', line 127

def get_municipality_by_id_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MunicipalityApi.get_municipality_by_id ..."
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling MunicipalityApi.get_municipality_by_id"
  end
  # resource path
  local_var_path = "/municipalities/{id}".sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Municipality')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MunicipalityApi#get_municipality_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_municipality_financials(id, opts = {}) ⇒ ApiResponseMunicipalitiyFinancials

Financials for a Municipality Returns financial statement data for the Municipality with the given ID

Parameters:

  • id

    An Intrinio ID of a Municipality

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

    the optional parameters

Options Hash (opts):

  • :fiscal_year (Float)

    Return financials for the given fiscal year

Returns:



171
172
173
174
# File 'lib/intrinio-sdk/api/municipality_api.rb', line 171

def get_municipality_financials(id, opts = {})
  data, _status_code, _headers = get_municipality_financials_with_http_info(id, opts)
  return data
end

#get_municipality_financials_with_http_info(id, opts = {}) ⇒ Array<(ApiResponseMunicipalitiyFinancials, Fixnum, Hash)>

Financials for a Municipality Returns financial statement data for the Municipality with the given ID

Parameters:

  • id

    An Intrinio ID of a Municipality

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

    the optional parameters

Options Hash (opts):

  • :fiscal_year (Float)

    Return financials for the given fiscal year

Returns:



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/intrinio-sdk/api/municipality_api.rb', line 182

def get_municipality_financials_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MunicipalityApi.get_municipality_financials ..."
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling MunicipalityApi.get_municipality_financials"
  end
  # resource path
  local_var_path = "/municipalities/{id}/financials".sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'fiscal_year'] = opts[:'fiscal_year'] if !opts[:'fiscal_year'].nil?

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ApiResponseMunicipalitiyFinancials')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MunicipalityApi#get_municipality_financials\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end