Sha256: de7c571cef5dd6e7293540cdf4378eae6b5c74a3f484b1de2a31756d694fd4b6
Contents?: true
Size: 636 Bytes
Versions: 2
Compression:
Stored size: 636 Bytes
Contents
# frozen_string_literal: true class Runa::Products < Runa::Response PATH = '/product' attr_accessor :all # Product Details List # GET /v2/product def get(ctx) response = ctx.request(:get, PATH, {}, '') parse(response) end # Find all products by fieldname. def find(name, value) Runa::Products.new(all: all.select! { |p| p.send(name).eql?(value) }) end def parse(response) super(response) if is_successful? # TODO: separate? if @payload['catalog'] @all = @payload['catalog'].map { |p| Runa::Product.new(p) } end else @all = [] end self end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
runa-ruby-client-0.2.1 | lib/runa/models/products.rb |
runa-ruby-client-0.1.0 | lib/runa/models/products.rb |