Class: EasyLlama::Client::Locations

Inherits:
Api
  • Object
show all
Defined in:
lib/easyllama/locations.rb

Overview

This class provides methods for interacting with the Easy Llama API for locations.

Constant Summary

Constants inherited from Api

Api::DEFAULT_API_VERSION, Api::DEFAULT_URI_BASE

Instance Method Summary collapse

Methods inherited from Api

#initialize, #parse_response!, #send_request

Constructor Details

This class inherits a constructor from EasyLlama::Client::Api

Instance Method Details

#all(page: 1) ⇒ Array

Sends a GET request to retrieve all locations.

Parameters:

  • page (Integer) (defaults to: 1)

    The page number.

Returns:

  • (Array)

    The locations or an error message.



11
12
13
14
15
# File 'lib/easyllama/locations.rb', line 11

def all(page: 1)
  response = send_request(path: '/locations', body: { page: })

  parse_response!(response, 'locations')
end

#create(location_attributes = {}) ⇒ Object

Sends a POST request to create a location.

Parameters:

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

    The attributes of the location.

Returns:

  • (Object)

    The created location or an error message.



21
22
23
24
25
# File 'lib/easyllama/locations.rb', line 21

def create(location_attributes = {})
  response = send_request(path: '/locations', method: :post, body: location_attributes)

  parse_response!(response, 'location')
end