module LightspeedRestaurantClient::Operations::Create

Public Instance Methods

create(attributes, configuration = nil) click to toggle source
# File lib/lightspeed_restaurant/operations/create.rb, line 6
def create(attributes, configuration = nil)
  response = JSON.parse(LightspeedRestaurantClient.post(default_resource_path, attributes, {}, configuration))
  response = handle_create_response(response, attributes)
  return new(response) if is_a?(Class)

  self.class.new(response)
end

Private Instance Methods

handle_create_response(response, attributes) click to toggle source
# File lib/lightspeed_restaurant/operations/create.rb, line 16
def handle_create_response(response, attributes)
  case response
  when Numeric
    attributes.merge(id: response)
  else
    response
  end
end