Class: SKApi::Resources::Base

Inherits:
ActiveResource::Base show all
Includes:
Utils::Serializer
Defined in:
lib/resources/base.rb

Direct Known Subclasses

Address, Client, CreditNote, Invoice, LineItem, Product

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils::Serializer

included

Methods inherited from ActiveResource::Base

#encode, instantiate_collection, #load_attributes_from_response

Constructor Details

#initialize(attributes = {}) ⇒ Base

Returns a new instance of Base.



10
11
12
13
# File 'lib/resources/base.rb', line 10

def initialize(attributes = {}, *args)
  attr = attributes[self.class.element_name] || attributes
  super(attr, *args)
end

Class Method Details

.set_connection(opts) ⇒ Object

Define the connection to be used when talking to a salesking server



22
23
24
25
26
27
# File 'lib/resources/base.rb', line 22

def self.set_connection(opts)
  self.site     = opts[:site]
  self.user     = opts[:user]
  self.password = opts[:password]
  self.format   = opts[:format].to_sym
end