Sha256: 0d1b0bad5e216d9ff155906427aa87acaf4e2b4b8f4dc2498c77549b3f38820d

Contents?: true

Size: 887 Bytes

Versions: 2

Compression:

Stored size: 887 Bytes

Contents

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

  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)
    self.parse(response)
  end

  def parse(response)
    super(response)
    Wegift::Product.new(@payload)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

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