Class: Dodopayments::Resources::ProductCollections::Groups

Inherits:
Object
  • Object
show all
Defined in:
lib/dodopayments/resources/product_collections/groups.rb,
lib/dodopayments/resources/product_collections/groups/items.rb

Defined Under Namespace

Classes: Items

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Groups

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Groups.

Parameters:



102
103
104
105
# File 'lib/dodopayments/resources/product_collections/groups.rb', line 102

def initialize(client:)
  @client = client
  @items = Dodopayments::Resources::ProductCollections::Groups::Items.new(client: client)
end

Instance Attribute Details

#itemsDodopayments::Resources::ProductCollections::Groups::Items (readonly)



8
9
10
# File 'lib/dodopayments/resources/product_collections/groups.rb', line 8

def items
  @items
end

Instance Method Details

#create(id, products:, group_name: nil, status: nil, request_options: {}) ⇒ Dodopayments::Models::ProductCollections::ProductCollectionGroupResponse

Some parameter documentations has been truncated, see Models::ProductCollections::GroupCreateParams for more details.

Parameters:

Returns:

See Also:



28
29
30
31
32
33
34
35
36
37
# File 'lib/dodopayments/resources/product_collections/groups.rb', line 28

def create(id, params)
  parsed, options = Dodopayments::ProductCollections::GroupCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["product-collections/%1$s/groups", id],
    body: parsed,
    model: Dodopayments::ProductCollections::ProductCollectionGroupResponse,
    options: options
  )
end

#delete(group_id, id:, request_options: {}) ⇒ nil

Parameters:

  • group_id (String)

    Product Collection Group Id

  • id (String)

    Product Collection Id

  • request_options (Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/dodopayments/resources/product_collections/groups.rb', line 85

def delete(group_id, params)
  parsed, options = Dodopayments::ProductCollections::GroupDeleteParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["product-collections/%1$s/groups/%2$s", id, group_id],
    model: NilClass,
    options: options
  )
end

#update(group_id, id:, group_name: nil, product_order: nil, status: nil, request_options: {}) ⇒ nil

Some parameter documentations has been truncated, see Models::ProductCollections::GroupUpdateParams for more details.

Parameters:

  • group_id (String)

    Path param: Product Collection Group Id

  • id (String)

    Path param: Product Collection Id

  • group_name (String, nil)

    Body param: Optional group name update: Some(Some(name)) = set name, Some(None)

  • product_order (Array<String>, nil)

    Body param: Optional new order for products in this group (array of product_coll

  • status (Boolean, nil)

    Body param: Optional status update

  • request_options (Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/dodopayments/resources/product_collections/groups.rb', line 59

def update(group_id, params)
  parsed, options = Dodopayments::ProductCollections::GroupUpdateParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :patch,
    path: ["product-collections/%1$s/groups/%2$s", id, group_id],
    body: parsed,
    model: NilClass,
    options: options
  )
end