Class: XeroRuby::AssetApi
- Inherits:
-
Object
- Object
- XeroRuby::AssetApi
- Defined in:
- lib/xero-ruby/api/asset_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_asset(xero_tenant_id, asset, opts = {}) ⇒ Asset
adds a fixed asset Adds an asset to the system.
-
#create_asset_type(xero_tenant_id, asset_type, opts = {}) ⇒ AssetType
adds a fixed asset type Adds an fixed asset type to the system.
-
#create_asset_type_with_http_info(xero_tenant_id, asset_type, options = {}) ⇒ Array<(AssetType, Integer, Hash)>
adds a fixed asset type Adds an fixed asset type to the system.
-
#create_asset_with_http_info(xero_tenant_id, asset, options = {}) ⇒ Array<(Asset, Integer, Hash)>
adds a fixed asset Adds an asset to the system.
-
#get_asset_by_id(xero_tenant_id, id, opts = {}) ⇒ Asset
Retrieves fixed asset by id By passing in the appropriate asset id, you can search for a specific fixed asset in the system.
-
#get_asset_by_id_with_http_info(xero_tenant_id, id, options = {}) ⇒ Array<(Asset, Integer, Hash)>
Retrieves fixed asset by id By passing in the appropriate asset id, you can search for a specific fixed asset in the system.
-
#get_asset_settings(xero_tenant_id, opts = {}) ⇒ Setting
searches fixed asset settings By passing in the appropriate options, you can search for available fixed asset types in the system.
-
#get_asset_settings_with_http_info(xero_tenant_id, options = {}) ⇒ Array<(Setting, Integer, Hash)>
searches fixed asset settings By passing in the appropriate options, you can search for available fixed asset types in the system.
-
#get_asset_types(xero_tenant_id, opts = {}) ⇒ Array<AssetType>
searches fixed asset types By passing in the appropriate options, you can search for available fixed asset types in the system.
-
#get_asset_types_with_http_info(xero_tenant_id, options = {}) ⇒ Array<(Array<AssetType>, Integer, Hash)>
searches fixed asset types By passing in the appropriate options, you can search for available fixed asset types in the system.
-
#get_assets(xero_tenant_id, status, opts = {}) ⇒ Assets
searches fixed asset By passing in the appropriate options, you can search for available fixed asset in the system.
-
#get_assets_with_http_info(xero_tenant_id, status, options = {}) ⇒ Array<(Assets, Integer, Hash)>
searches fixed asset By passing in the appropriate options, you can search for available fixed asset in the system.
-
#initialize(api_client = ApiClient.new) ⇒ AssetApi
constructor
A new instance of AssetApi.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
14 15 16 |
# File 'lib/xero-ruby/api/asset_api.rb', line 14 def api_client @api_client end |
Instance Method Details
#create_asset(xero_tenant_id, asset, opts = {}) ⇒ Asset
adds a fixed asset Adds an asset to the system
26 27 28 29 |
# File 'lib/xero-ruby/api/asset_api.rb', line 26 def create_asset(xero_tenant_id, asset, opts = {}) data, _status_code, _headers = create_asset_with_http_info(xero_tenant_id, asset, opts) data end |
#create_asset_type(xero_tenant_id, asset_type, opts = {}) ⇒ AssetType
adds a fixed asset type Adds an fixed asset type to the system
108 109 110 111 |
# File 'lib/xero-ruby/api/asset_api.rb', line 108 def create_asset_type(xero_tenant_id, asset_type, opts = {}) data, _status_code, _headers = create_asset_type_with_http_info(xero_tenant_id, asset_type, opts) data end |
#create_asset_type_with_http_info(xero_tenant_id, asset_type, options = {}) ⇒ Array<(AssetType, Integer, Hash)>
adds a fixed asset type Adds an fixed asset type to the system
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 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/xero-ruby/api/asset_api.rb', line 120 def create_asset_type_with_http_info(xero_tenant_id, asset_type, = {}) opts = .dup if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AssetApi.create_asset_type ...' end # verify the required parameter 'xero_tenant_id' is set if @api_client.config.client_side_validation && xero_tenant_id.nil? fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling AssetApi.create_asset_type" end # verify the required parameter 'asset_type' is set if @api_client.config.client_side_validation && asset_type.nil? fail ArgumentError, "Missing the required parameter 'asset_type' when calling AssetApi.create_asset_type" end # resource path local_var_path = '/AssetTypes' # camelize keys of incoming `where` opts opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil? # query parameters query_params = opts[:query_params] || {} # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations: query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil? query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params[:'xero-tenant-id'] = xero_tenant_id header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(asset_type) # return_type return_type = opts[:return_type] || 'AssetType' # auth_names auth_names = opts[:auth_names] || ['OAuth2'] = opts.merge( :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(:POST, local_var_path, "AssetApi", ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AssetApi#create_asset_type\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_asset_with_http_info(xero_tenant_id, asset, options = {}) ⇒ Array<(Asset, Integer, Hash)>
adds a fixed asset Adds an asset to the system
38 39 40 41 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 91 92 93 94 95 96 97 98 99 |
# File 'lib/xero-ruby/api/asset_api.rb', line 38 def create_asset_with_http_info(xero_tenant_id, asset, = {}) opts = .dup if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AssetApi.create_asset ...' end # verify the required parameter 'xero_tenant_id' is set if @api_client.config.client_side_validation && xero_tenant_id.nil? fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling AssetApi.create_asset" end # verify the required parameter 'asset' is set if @api_client.config.client_side_validation && asset.nil? fail ArgumentError, "Missing the required parameter 'asset' when calling AssetApi.create_asset" end # resource path local_var_path = '/Assets' # camelize keys of incoming `where` opts opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil? # query parameters query_params = opts[:query_params] || {} # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations: query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil? query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params[:'xero-tenant-id'] = xero_tenant_id header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(asset) # return_type return_type = opts[:return_type] || 'Asset' # auth_names auth_names = opts[:auth_names] || ['OAuth2'] = opts.merge( :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(:POST, local_var_path, "AssetApi", ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AssetApi#create_asset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_asset_by_id(xero_tenant_id, id, opts = {}) ⇒ Asset
Retrieves fixed asset by id By passing in the appropriate asset id, you can search for a specific fixed asset in the system
189 190 191 192 |
# File 'lib/xero-ruby/api/asset_api.rb', line 189 def get_asset_by_id(xero_tenant_id, id, opts = {}) data, _status_code, _headers = get_asset_by_id_with_http_info(xero_tenant_id, id, opts) data end |
#get_asset_by_id_with_http_info(xero_tenant_id, id, options = {}) ⇒ Array<(Asset, Integer, Hash)>
Retrieves fixed asset by id By passing in the appropriate asset id, you can search for a specific fixed asset in the system
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/xero-ruby/api/asset_api.rb', line 200 def get_asset_by_id_with_http_info(xero_tenant_id, id, = {}) opts = .dup if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AssetApi.get_asset_by_id ...' end # verify the required parameter 'xero_tenant_id' is set if @api_client.config.client_side_validation && xero_tenant_id.nil? fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling AssetApi.get_asset_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 AssetApi.get_asset_by_id" end # resource path local_var_path = '/Assets/{id}'.sub('{' + 'id' + '}', id.to_s) # camelize keys of incoming `where` opts opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil? # query parameters query_params = opts[:query_params] || {} # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations: query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil? query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'xero-tenant-id'] = xero_tenant_id # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Asset' # auth_names auth_names = opts[:auth_names] || ['OAuth2'] = opts.merge( :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, "AssetApi", ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AssetApi#get_asset_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_asset_settings(xero_tenant_id, opts = {}) ⇒ Setting
searches fixed asset settings By passing in the appropriate options, you can search for available fixed asset types in the system
265 266 267 268 |
# File 'lib/xero-ruby/api/asset_api.rb', line 265 def get_asset_settings(xero_tenant_id, opts = {}) data, _status_code, _headers = get_asset_settings_with_http_info(xero_tenant_id, opts) data end |
#get_asset_settings_with_http_info(xero_tenant_id, options = {}) ⇒ Array<(Setting, Integer, Hash)>
searches fixed asset settings By passing in the appropriate options, you can search for available fixed asset types in the system
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 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
# File 'lib/xero-ruby/api/asset_api.rb', line 275 def get_asset_settings_with_http_info(xero_tenant_id, = {}) opts = .dup if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AssetApi.get_asset_settings ...' end # verify the required parameter 'xero_tenant_id' is set if @api_client.config.client_side_validation && xero_tenant_id.nil? fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling AssetApi.get_asset_settings" end # resource path local_var_path = '/Settings' # camelize keys of incoming `where` opts opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil? # query parameters query_params = opts[:query_params] || {} # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations: query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil? query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'xero-tenant-id'] = xero_tenant_id # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Setting' # auth_names auth_names = opts[:auth_names] || ['OAuth2'] = opts.merge( :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, "AssetApi", ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AssetApi#get_asset_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_asset_types(xero_tenant_id, opts = {}) ⇒ Array<AssetType>
searches fixed asset types By passing in the appropriate options, you can search for available fixed asset types in the system
336 337 338 339 |
# File 'lib/xero-ruby/api/asset_api.rb', line 336 def get_asset_types(xero_tenant_id, opts = {}) data, _status_code, _headers = get_asset_types_with_http_info(xero_tenant_id, opts) data end |
#get_asset_types_with_http_info(xero_tenant_id, options = {}) ⇒ Array<(Array<AssetType>, Integer, Hash)>
searches fixed asset types By passing in the appropriate options, you can search for available fixed asset types in the system
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 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 |
# File 'lib/xero-ruby/api/asset_api.rb', line 346 def get_asset_types_with_http_info(xero_tenant_id, = {}) opts = .dup if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AssetApi.get_asset_types ...' end # verify the required parameter 'xero_tenant_id' is set if @api_client.config.client_side_validation && xero_tenant_id.nil? fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling AssetApi.get_asset_types" end # resource path local_var_path = '/AssetTypes' # camelize keys of incoming `where` opts opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil? # query parameters query_params = opts[:query_params] || {} # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations: query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil? query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'xero-tenant-id'] = xero_tenant_id # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Array<AssetType>' # auth_names auth_names = opts[:auth_names] || ['OAuth2'] = opts.merge( :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, "AssetApi", ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AssetApi#get_asset_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_assets(xero_tenant_id, status, opts = {}) ⇒ Assets
searches fixed asset By passing in the appropriate options, you can search for available fixed asset in the system
413 414 415 416 |
# File 'lib/xero-ruby/api/asset_api.rb', line 413 def get_assets(xero_tenant_id, status, opts = {}) data, _status_code, _headers = get_assets_with_http_info(xero_tenant_id, status, opts) data end |
#get_assets_with_http_info(xero_tenant_id, status, options = {}) ⇒ Array<(Assets, Integer, Hash)>
searches fixed asset By passing in the appropriate options, you can search for available fixed asset in the system
429 430 431 432 433 434 435 436 437 438 439 440 441 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 |
# File 'lib/xero-ruby/api/asset_api.rb', line 429 def get_assets_with_http_info(xero_tenant_id, status, = {}) opts = .dup if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AssetApi.get_assets ...' end # verify the required parameter 'xero_tenant_id' is set if @api_client.config.client_side_validation && xero_tenant_id.nil? fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling AssetApi.get_assets" end # verify the required parameter 'status' is set if @api_client.config.client_side_validation && status.nil? fail ArgumentError, "Missing the required parameter 'status' when calling AssetApi.get_assets" end allowable_values = ["AssetType", "AssetName", "AssetNumber", "PurchaseDate", "PurchasePrice", "DisposalDate", "DisposalPrice"] if @api_client.config.client_side_validation && opts[:'order_by'] && !allowable_values.include?(opts[:'order_by']) fail ArgumentError, "invalid value for \"order_by\", must be one of #{allowable_values}" end allowable_values = ["asc", "desc"] if @api_client.config.client_side_validation && opts[:'sort_direction'] && !allowable_values.include?(opts[:'sort_direction']) fail ArgumentError, "invalid value for \"sort_direction\", must be one of #{allowable_values}" end # resource path local_var_path = '/Assets' # camelize keys of incoming `where` opts opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil? # query parameters query_params = opts[:query_params] || {} query_params[:'status'] = status query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'orderBy'] = opts[:'order_by'] if !opts[:'order_by'].nil? query_params[:'sortDirection'] = opts[:'sort_direction'] if !opts[:'sort_direction'].nil? query_params[:'filterBy'] = opts[:'filter_by'] if !opts[:'filter_by'].nil? # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations: query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil? query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'xero-tenant-id'] = xero_tenant_id # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Assets' # auth_names auth_names = opts[:auth_names] || ['OAuth2'] = opts.merge( :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, "AssetApi", ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AssetApi#get_assets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |