Sha256: a534f35273825c9dd0fe91a9323585bfe1c8cf36a564241c054623acb6c37fe5

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

class Wegift::Product < Wegift::Response
  PATH = '/products'

  # request/payload
  attr_accessor :product_code

  # response/success
  attr_accessor :code, :name, :description, :currency_code, :availability,
                :denomination_type, :minimum_value, :maximum_value,
                :card_image_url, :expiry_date_policy,
                :redeem_instructions_html,
                :terms_and_conditions_html,
                :terms_and_conditions_url,
                :terms_and_conditions_pdf_url,
                :e_code_usage_type,
                :barcode_format,
                :countries,
                :categories,
                :state

  def initialize(params = {})
    super
  end

  def path
    [PATH, @product_code.to_s].join('/')
  end

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

  def parse(response)
    super(response)

    Wegift::Product.new(@payload)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wegift-ruby-client-1.10.2 lib/wegift/models/product.rb
wegift-ruby-client-1.10.0 lib/wegift/models/product.rb
wegift-ruby-client-1.9.1 lib/wegift/models/product.rb
wegift-ruby-client-1.9.0 lib/wegift/models/product.rb
wegift-ruby-client-1.8.4 lib/wegift/models/product.rb