Sha256: a2a1be111cbec7dc1c8ee72cff01dc023b144cd47479a2939e28a1a94ebc9c14

Contents?: true

Size: 411 Bytes

Versions: 1

Compression:

Stored size: 411 Bytes

Contents

require_relative 'response'

class Wegift::Products < Wegift::Response

  PATH = '/products'

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

  def parse(data)
    super(data)

    # TODO separate?
    if data['products']
      data['products'].map{|p| Wegift::Product.new(p)}
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

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