class Promisepay::BaseModel

Base model for all the other models to inherit from

Public Class Methods

new(client, attributes = {}) click to toggle source
# File lib/promisepay/models/base_model.rb, line 4
def initialize(client, attributes = {})
  @client = client
  @attributes = stringify_keys(attributes)
end

Public Instance Methods

method_missing(name, *args, &block) click to toggle source
Calls superclass method
# File lib/promisepay/models/base_model.rb, line 9
def method_missing(name, *args, &block)
  if @attributes.key?(name.to_s)
    @attributes[name.to_s]
  else
    super
  end
end

Private Instance Methods

stringify_keys(hash) click to toggle source
# File lib/promisepay/models/base_model.rb, line 19
def stringify_keys(hash)
  Hash[hash.map { |k, v| [k.to_s, v] }]
end