Class: Signatory::API::Base
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- Signatory::API::Base
show all
- Defined in:
- lib/signatory/api/base.rb,
lib/signatory/legacy_active_resource_hacks.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.all(*args) ⇒ Object
8
9
10
|
# File 'lib/signatory/legacy_active_resource_hacks.rb', line 8
def all(*args)
find(:all, *args)
end
|
.connection(refresh = false) ⇒ Object
ActiveResource < 3.0.0 does not support auth_type
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/signatory/legacy_active_resource_hacks.rb', line 13
def connection(refresh = false)
if defined?(@connection) || superclass == Object
@connection = Signatory::API::Connection.new(site, format) if refresh || @connection.nil?
@connection.proxy = proxy if proxy
@connection.user = user if user
@connection.password = password if password
@connection.auth_type = auth_type if auth_type
@connection.timeout = timeout if timeout
@connection.ssl_options = ssl_options if ssl_options
@connection
else
superclass.connection
end
end
|
22
23
24
|
# File 'lib/signatory/api/base.rb', line 22
def formatted_collection_name
self.name.split('::').last.downcase.pluralize
end
|
18
19
20
|
# File 'lib/signatory/api/base.rb', line 18
def formatted_name
self.name.split('::').last.downcase
end
|
.instantiate_collection(collection, opts) ⇒ Object
11
12
13
14
15
16
|
# File 'lib/signatory/api/base.rb', line 11
def instantiate_collection(collection, opts)
if collection.has_key?(formatted_collection_name)
collection = collection[formatted_collection_name]
end
super([collection[formatted_name]].flatten, opts)
end
|
Instance Method Details
#id ⇒ Object
6
7
8
|
# File 'lib/signatory/api/base.rb', line 6
def id
guid
end
|
#to_xml(options = {}) ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/signatory/legacy_active_resource_hacks.rb', line 28
def to_xml(options={})
fixed_attrs = attributes.clone
options[:except].each do |k|
fixed_attrs.delete(k.to_s)
end
fixed_attrs.to_xml({:root => self.class.element_name}.merge(options)){|b| yield(b) if block_given?}
end
|