Class: Clicksign::Signer
- Inherits:
-
Base
- Object
- Base
- Clicksign::Signer
show all
- Defined in:
- lib/clicksign/signer.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
api_url, build_data, headers, parse, request
Constructor Details
#initialize(envelope_key) ⇒ Signer
Returns a new instance of Signer.
11
12
13
|
# File 'lib/clicksign/signer.rb', line 11
def initialize(envelope_key)
@envelope_key = envelope_key
end
|
Instance Attribute Details
#envelope_key ⇒ Object
Returns the value of attribute envelope_key.
9
10
11
|
# File 'lib/clicksign/signer.rb', line 9
def envelope_key
@envelope_key
end
|
Class Method Details
.model_name ⇒ Object
5
6
7
|
# File 'lib/clicksign/signer.rb', line 5
def self.model_name
'signers'
end
|
Instance Method Details
#add(params = {}) ⇒ Object
19
20
21
22
23
24
|
# File 'lib/clicksign/signer.rb', line 19
def add params={}
Base.request :post,
Base.api_url('envelopes', @envelope_key, model_name),
Base.build_data(params, model_name),
{}
end
|
#delete(signer_key) ⇒ Object
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/clicksign/signer.rb', line 26
def delete signer_key
raise StandardError, 'Signer key is required' unless signer_key.present?
envelope = Clicksign::Envelope.new(@envelope_key).retrieve
raise StandardError, "Envelope #{@envelope_key} not in state for delete." unless envelope["data"]["attributes"]["status"].in? ["running", "draft"]
Base.request :delete,
Base.api_url('envelopes', @envelope_key, model_name, signer_key),
{}
end
|
#model_name ⇒ Object
15
16
17
|
# File 'lib/clicksign/signer.rb', line 15
def model_name
self.class.model_name
end
|