Sha256: cb6610aaf1e58258427d65afa6c9590d44b19a3e3c877b45d27f637583bc005c

Contents?: true

Size: 649 Bytes

Versions: 4

Compression:

Stored size: 649 Bytes

Contents

module SKApi
  module Resources

    class Base < ActiveResource::Base
      include SKApi::Utils::Serializer
      self.format = :json # bug in AR must be set here
      
      def initialize(attributes = {})
        # json comes in nested {client={data}
        attr = attributes[self.class.element_name] || attributes
        super(attr)
      end

      # Define the connection to be used when talking to a salesking server
      def self.set_connection(opts)
        self.site     = opts[:site]
        self.user     = opts[:user]
        self.password = opts[:password]
        self.format   = opts[:format].to_sym
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sk-api-1.1.0 lib/resources/base.rb
sk-api-1.0.6 lib/resources/base.rb
sk-api-1.0.5 lib/resources/base.rb
sk-api-1.0.4 lib/resources/base.rb