class Smartfocus4rails::Base

Public Class Methods

attributes(*names) click to toggle source
# File lib/smartfocus4rails/models/base.rb, line 24
def self.attributes(*names)
        attr_accessor *names
        define_attribute_methods names

        self._attributes += names
end

Public Instance Methods

attributes() click to toggle source
# File lib/smartfocus4rails/models/base.rb, line 31
def attributes
        self._attributes.inject({}) do |hash, attr|
                hash[attr.to_s] = send(attr)
                hash
        end
end
persisted?() click to toggle source
# File lib/smartfocus4rails/models/base.rb, line 38
def persisted?
        false
end
to_emv() click to toggle source
# File lib/smartfocus4rails/models/base.rb, line 42
def to_emv
        attributes.reject {|k,v| v.nil?}
end

Protected Instance Methods

api() click to toggle source
# File lib/smartfocus4rails/models/base.rb, line 48
def api
        @api ||= Smartfocus::Api.new :endpoint => "apiccmd"
        @api.open_connection unless @api.connected?
        @api
end
attribute?(attribute) click to toggle source
# File lib/smartfocus4rails/models/base.rb, line 54
def attribute?(attribute)
        send(attribute).present?
end