Class: SDSActiveResource::Base

Inherits:
ActiveResource::Base
  • Object
show all
Defined in:
lib/sds-activeresource.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.connection(refresh = false) ⇒ Object



12
13
14
15
16
17
# File 'lib/sds-activeresource.rb', line 12

def self.connection(refresh = false)
    @connection = SDSConnection.new(super.site, super.format) if refresh || @connection.nil?
    @connection.user = user
    @connection.password = password
    @connection
end

.query(query) ⇒ Object



27
28
29
# File 'lib/sds-activeresource.rb', line 27

def self.query(query)
  instantiate_collection(@connection.query(collection_path(), query))
end

Instance Method Details

#to_xml(options = {}) ⇒ Object

we don't want to create XML, we want to pass the attributes directly to the SDS service where the XML can be created



20
21
22
23
24
25
# File 'lib/sds-activeresource.rb', line 20

def to_xml(options={})
  newattributes = {}
  newattributes.merge! attributes
  newattributes["entityname"] = self.class.element_name
  newattributes
end