Class: Xolphin::Api::Responses::Products

Inherits:
Base
  • Object
show all
Defined in:
lib/xolphin/api/responses/products.rb

Instance Method Summary collapse

Methods inherited from Base

#_embedded, #error?, #errors, #limit, #message, #page, #pages, #total

Constructor Details

#initialize(data) ⇒ Products

Returns a new instance of Products.



5
6
7
# File 'lib/xolphin/api/responses/products.rb', line 5

def initialize(data)
  super(data)
end

Instance Method Details

#productsObject



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/xolphin/api/responses/products.rb', line 9

def products
  @products ||= begin
    products = []

    if _embedded && _embedded["products"]
      _embedded["products"].each do |product|
        products << Product.new(product)
      end
    end

    products
  end
end