Module: LoyverseApi::Endpoints::Modifiers

Included in:
Client
Defined in:
lib/loyverse_api/endpoints/modifiers.rb

Instance Method Summary collapse

Instance Method Details

#create_modifier(name:, options:) ⇒ Hash

Create a new modifier

Parameters:

  • name (String) —

    Modifier name

  • options (Array<Hash>) —

    Array of modifier options with name and price

Returns:

  • (Hash) —

    Created modifier details



34
35
36
37
38
39
40
41
# File 'lib/loyverse_api/endpoints/modifiers.rb', line 34

def create_modifier(name:, options:)
  body = {
    name: name,
    options: options
  }

  post("modifiers", body: body)
end

#delete_modifier(modifier_id) ⇒ Hash

Delete a modifier

Parameters:

  • modifier_id (String) —

    UUID of the modifier

Returns:

  • (Hash) —

    Response



46
47
48
# File 'lib/loyverse_api/endpoints/modifiers.rb', line 46

def delete_modifier(modifier_id)
  delete("modifiers/#{modifier_id}")
end

#get_modifier(modifier_id) ⇒ Hash

Get a specific modifier by ID

Parameters:

  • modifier_id (String) —

    UUID of the modifier

Returns:

  • (Hash) —

    Modifier details



9
10
11
# File 'lib/loyverse_api/endpoints/modifiers.rb', line 9

def get_modifier(modifier_id)
  get("modifiers/#{modifier_id}")
end

#list_modifiers(limit: 250, cursor: nil, updated_at_min: nil, updated_at_max: nil) ⇒ Hash

List modifiers

Parameters:

  • limit (Integer) (defaults to: 250) —

    Maximum number of results per page (default: 250)

  • cursor (String) (defaults to: nil) —

    Pagination cursor for next page

  • updated_at_min (String, Time) (defaults to: nil) —

    Filter by minimum update time (ISO 8601)

  • updated_at_max (String, Time) (defaults to: nil) —

    Filter by maximum update time (ISO 8601)

Returns:

  • (Hash) —

    Response with modifiers array



19
20
21
22
23
24
25
26
27
28
# File 'lib/loyverse_api/endpoints/modifiers.rb', line 19

def list_modifiers(limit: 250, cursor: nil, updated_at_min: nil, updated_at_max: nil)
  params = {
    limit: limit,
    cursor: cursor,
    updated_at_min: format_time(updated_at_min),
    updated_at_max: format_time(updated_at_max)
  }.compact

  get("modifiers", params: params)
end