Class: Docusigner::Base
- Inherits:
-
ReactiveResource::Base
- Object
- ReactiveResource::Base
- Docusigner::Base
show all
- Includes:
- Multipart::Resource
- Defined in:
- lib/docusigner/base.rb
Direct Known Subclasses
Account, BillingPlan, Brand, CustomField, Document, Envelope, Folder, Group, LoginInformation, Oauth2, Profile, ProfileImage, Recipient, Settings, Tab, Template, User, UserSettings
Class Method Summary
collapse
Instance Method Summary
collapse
#add_document, #encode
Class Method Details
.act_as_user(user, &block) ⇒ Object
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/docusigner/base.rb', line 39
def act_as_user(user, &block)
= .delete('X-DocuSign-Act-As-User')
['X-DocuSign-Act-As-User'] = user
yield
if .nil?
.delete('X-DocuSign-Act-As-User')
else
['X-DocuSign-Act-As-User'] =
end
end
|
.authorization=(options = {}) ⇒ Object
35
36
37
|
# File 'lib/docusigner/base.rb', line 35
def authorization=(options = {})
['X-DocuSign-Authentication'] = "<DocuSignCredentials><Username>%{username}</Username><Password>%{password}</Password><IntegratorKey>%{integrator_key}</IntegratorKey></DocuSignCredentials>" % options
end
|
.connection(refresh = false) ⇒ Object
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/docusigner/base.rb', line 20
def connection(refresh = false)
if defined?(@connection) || self == Docusigner::Base
@connection = Docusigner::Connection.new(site, format) if refresh || @connection.nil? || !@connection.is_a?(Docusigner::Connection)
@connection.timeout = timeout if timeout
@connection.ssl_options = ssl_options if ssl_options
@connection
else
superclass.connection
end
end
|
we want to inherit headers for authentication
14
15
16
17
18
|
# File 'lib/docusigner/base.rb', line 14
def
@headers ||= begin
superclass.respond_to?(:headers) ? superclass..dup : {}
end
end
|
.token=(token) ⇒ Object
31
32
33
|
# File 'lib/docusigner/base.rb', line 31
def token=(token)
['Authorization'] = "Bearer #{token}"
end
|
Instance Method Details
#to_json(opts = {}) ⇒ Object
the json should skip the root element
91
92
93
|
# File 'lib/docusigner/base.rb', line 91
def to_json(opts = {})
as_json.to_json
end
|