Sha256: 49e390f4ee05e46c5123f1cc5564211953af7ac16bbaa19bd9a4a555f30552ed

Contents?: true

Size: 488 Bytes

Versions: 2

Compression:

Stored size: 488 Bytes

Contents

class Wegift::Products < Wegift::Response

  PATH = '/products'

  attr_accessor :all

  # Product Details List
  # GET /api/b2b-sync/v1/products/
  def get(ctx)
    response = ctx.request(:get, PATH)
    self.parse(response)
  end

  def parse(response)
    super(response)

    if self.is_successful?
      # TODO separate?
      if @payload['products']
        @all = @payload['products'].map{|p| Wegift::Product.new(p)}
      end
    else
      @all = []
    end

    self
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wegift-ruby-client-1.7.2 lib/wegift/models/products.rb
wegift-ruby-client-1.7.1 lib/wegift/models/products.rb