Module: Recharge::HTTPRequest::List

Includes:
Recharge::HTTPRequest
Included in:
Charge, Customer, Discount, Metafield, Order, Product, Subscription, Webhook
Defined in:
lib/recharge/http_request.rb

Overview

Retrieve a page of records for the included/extended class’ endpoint

Arguments

options (Hash)

Optional arguments to filter the result set on.

In most cases :page and :limit are accepted but see the appropriate call in ReCharge’s documentation for valid options.

Returns

Array of record instances

Errors

Recharge::ConnectionError, Recharge::RequestError

Instance Method Summary collapse

Instance Method Details

#list(options = nil) ⇒ Object



203
204
205
206
# File 'lib/recharge/http_request.rb', line 203

def list(options = nil)
  data = GET(self::PATH, options)
  (data[self::COLLECTION] || []).map { |d| new(d.merge("meta" => data["meta"])) }
end