Class: PayPal::ProductsResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/pay_pal/resources/products.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from PayPal::Resource

Instance Method Details

#create(name:, type:, **params) ⇒ Object



14
15
16
17
# File 'lib/pay_pal/resources/products.rb', line 14

def create(name:, type:, **params)
  attributes = {name: name, type: type}
  Product.new post_request("v1/catalogs/products", body: attributes.merge(params)).body
end

#listObject



4
5
6
7
# File 'lib/pay_pal/resources/products.rb', line 4

def list
  response = get_request("v1/catalogs/products")
  Collection.from_response(response, kind: "products", type: Product)
end

#retrieve(id:) ⇒ Object



9
10
11
12
# File 'lib/pay_pal/resources/products.rb', line 9

def retrieve(id:)
  response = get_request("v1/catalogs/products/#{id}")
  Product.new(response.body)
end