Class: Inkdit::FormContract

Inherits:
Resource show all
Defined in:
lib/inkdit/form_contract.rb

Overview

represents a form contract on Inkdit

Instance Attribute Summary

Attributes inherited from Resource

#url

Instance Method Summary collapse

Methods inherited from Resource

#==, #fetch!, #initialize, #inspect

Constructor Details

This class inherits a constructor from Inkdit::Resource

Instance Method Details

#contentString

Returns the contract’s content.

Returns:

  • (String)

    the contract’s content



10
11
12
# File 'lib/inkdit/form_contract.rb', line 10

def content
  @params['content']
end

#content_updated_atObject

an opaque string indicating the version of the form contract’s content



19
20
21
# File 'lib/inkdit/form_contract.rb', line 19

def content_updated_at
  @params['content_updated_at']
end

#nameString

Returns a human-readable name for the contract.

Returns:

  • (String)

    a human-readable name for the contract



5
6
7
# File 'lib/inkdit/form_contract.rb', line 5

def name
  @params['name']
end

#sign!Signature

sign this field as the user and entity associated with the current access token.

Returns:

  • (Signature)

    the newly-created signature



25
26
27
28
29
30
# File 'lib/inkdit/form_contract.rb', line 25

def sign!
  params = { :if_updated_at => self.content_updated_at }
  response = @client.post self.signatures_link, { :body => params.to_json, :headers => { 'Content-Type' => 'application/json' } }

  Inkdit::Signature.new(@client, response.parsed)
end


14
15
16
# File 'lib/inkdit/form_contract.rb', line 14

def signatures_link
  @params['links']['signatures']
end