Sha256: b65981d5d3f72765f679fa7bf9cfcc8ed6b6f79a8ef12743c74a7a3e6dabe908

Contents?: true

Size: 485 Bytes

Versions: 1

Compression:

Stored size: 485 Bytes

Contents

# frozen_string_literal: true

require 'faraday'
require 'uri'

module Wegift
  class RemoteCode < Response
    attr_accessor :url

    # response/success
    attr_accessor :amount, :barcode_format, :barcode_string, :code, :expiry_date,
      :pin, :type

    def get(ctx)
      parse(Faraday.get("#{url}?format=json"))
    end

    def parse(response)
      super

      if is_successful?
        self.class.new(@payload['e_code'])
      else
        self
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wegift-ruby-client-1.10.0 lib/wegift/models/remote_code.rb