Sha256: 237c07d1f2f63cddaa60cba589fc2765e418f35b81d9ca5d06ecad61077acd22

Contents?: true

Size: 858 Bytes

Versions: 2

Compression:

Stored size: 858 Bytes

Contents

require 'sigiss/integration'
require 'active_model'
module Sigiss
  class Invoice
    include ActiveModel::Validations
    include Sigiss::Integration

    attr_accessor :gateway, :provider, :taker, :data, :success, :response

    validates_presence_of :gateway, :provider, :taker, :data, :success, :response

    def initialize(attributes = {})
      @gateway = attributes[:gateway]
      @provider = attributes[:provider]
      @taker = attributes[:taker]
      @success = false
      @response = {}
    end

    def build(method, params = {})
      case method
      when :issue
        @data = Sigiss::IssueData.new(params)
      when :fetch
        @data = Sigiss::FetchData.new(params)
      when :cancel
        @data = Sigiss::CancelData.new(params)
      else
        @data = {}
      end
    end

    def success?
      @success
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sigiss-0.1.4 lib/sigiss/invoice.rb
sigiss-0.1.3 lib/sigiss/invoice.rb