Class: Clicksign::Envelope

Inherits:
Base
  • Object
show all
Defined in:
lib/clicksign/envelope.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) ⇒ Envelope

Returns a new instance of Envelope.



9
10
11
# File 'lib/clicksign/envelope.rb', line 9

def initialize(envelope_key)
  @envelope_key = envelope_key
end

Instance Attribute Details

#envelope_keyObject

Returns the value of attribute envelope_key.



7
8
9
# File 'lib/clicksign/envelope.rb', line 7

def envelope_key
  @envelope_key
end

Class Method Details

.create(params = {}) ⇒ Object



17
18
19
20
21
22
# File 'lib/clicksign/envelope.rb', line 17

def self.create params={}
  request :post,
    api_url(model_name),
    build_data(params, model_name),
    {}
end

.model_nameObject



3
4
5
# File 'lib/clicksign/envelope.rb', line 3

def self.model_name
  'envelopes'
end

Instance Method Details

#activate(params = { status: 'running' }) ⇒ Object



30
31
32
33
34
35
# File 'lib/clicksign/envelope.rb', line 30

def activate params={ status: 'running' }
  Base.request :patch,
    Base.api_url(model_name, @envelope_key),
    Base.build_data(params, model_name, @envelope_key),
    {}
end

#model_nameObject



13
14
15
# File 'lib/clicksign/envelope.rb', line 13

def model_name
  self.class.model_name
end

#retrieve(params = {}) ⇒ Object



24
25
26
27
28
# File 'lib/clicksign/envelope.rb', line 24

def retrieve params={}
  Base.request :get,
    Base.api_url(model_name, @envelope_key),
    {}
end

#update(params = {}) ⇒ Object



37
38
39
40
41
42
# File 'lib/clicksign/envelope.rb', line 37

def update params={}
  Base.request :patch,
    Base.api_url(model_name, @envelope_key),
    Base.build_data(params, model_name, @envelope_key),
    {}
end