Module: AuthorizeNet::Model

Overview

Provides some basic methods used by the various model classes.

Instance Method Summary collapse

Instance Method Details

#initialize(fields = {}) ⇒ Object

The constructor for models. Takes any of the supported attributes as key/value pairs.



132
133
134
135
136
137
138
139
# File 'lib/authorize_net/authorize_net.rb', line 132

def initialize(fields = {})
  fields.each do |k, v|
    method_name = (k.to_s + '=').to_sym
    if self.respond_to?(method_name)
      self.send(method_name, v)
    end
  end
end

#to_aObject



141
142
143
# File 'lib/authorize_net/authorize_net.rb', line 141

def to_a
  [self]
end