Class: Samurai::Base

Inherits:
ActiveResource::Base show all
Defined in:
lib/samurai/base.rb

Overview

Base class that all Samurai ActiveResource models inherit from Provides some common error-handling functionality, as well as the AR site settings

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.setup_site!Object



15
16
17
18
19
# File 'lib/samurai/base.rb', line 15

def self.setup_site!
  self.site = Samurai.site
  self.user = Samurai.merchant_key
  self.password = Samurai.merchant_password
end

Instance Method Details

#has_errors?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/samurai/base.rb', line 21

def has_errors?
  respond_to?(:errors) && errors && errors.count > 0
end