Class: Crema::Client
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#fetch_products(brand_id, page: 1, limit: 30, status: 'selling') ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/crema/client.rb', line 3 def fetch_products(brand_id, page: 1, limit: 30, status: 'selling') response = connection.get( '/v1/products', access_token: Crema.config.access_token, brand_id: brand_id, page: page, limit: limit, status: status ) return nil unless response.success? JSON.parse(response.body).map { |i| Product.new(i) } end |