Class: ZohoSign::Document::CreateService
- Inherits:
-
BaseService
- Object
- BaseService
- ZohoSign::Document::CreateService
- Defined in:
- lib/zoho_sign/document/create_service.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#file_content_type ⇒ Object
readonly
Returns the value of attribute file_content_type.
-
#file_name ⇒ Object
readonly
Returns the value of attribute file_name.
Instance Method Summary collapse
-
#call ⇒ Object
Create a document.
-
#initialize(data:, file:, file_content_type:, file_name: nil) ⇒ CreateService
constructor
A new instance of CreateService.
Constructor Details
#initialize(data:, file:, file_content_type:, file_name: nil) ⇒ CreateService
Returns a new instance of CreateService.
12 13 14 15 16 17 |
# File 'lib/zoho_sign/document/create_service.rb', line 12 def initialize(data:, file:, file_content_type:, file_name: nil) @file = file @file_content_type = file_content_type @file_name = file_name @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
4 5 6 |
# File 'lib/zoho_sign/document/create_service.rb', line 4 def data @data end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
4 5 6 |
# File 'lib/zoho_sign/document/create_service.rb', line 4 def file @file end |
#file_content_type ⇒ Object (readonly)
Returns the value of attribute file_content_type.
4 5 6 |
# File 'lib/zoho_sign/document/create_service.rb', line 4 def file_content_type @file_content_type end |
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
4 5 6 |
# File 'lib/zoho_sign/document/create_service.rb', line 4 def file_name @file_name end |
Instance Method Details
#call ⇒ Object
Create a document.
www.zoho.com/sign/api/document-managment/create-document.html
Examples
service = ZohoSign::Document::CreateService.call(
file: '/path/to/file.pdf', # or File.open('/path/to/file.pdf')
file_name: 'file.pdf',
file_content_type: 'application/pdf',
data: {
requests: {
request_name: 'Name',
is_sequential: false,
actions: [{
action_type: 'SIGN',
recipient_email: '[email protected]',
recipient_name: 'Eric Cartman',
verify_recipient: true,
verification_type: 'EMAIL'
}]
}
}
)
service.success? # => true
service.errors # => #<ActiveModel::Errors []>
service.response # => #<Faraday::Response ...>
service.response.status # => 200
service.response.body # => {}
service.facade # => #<ZohoSign::Document::Facade ...>
service.facade.request_name
service.request_name
POST /api/v1/requests
56 57 58 |
# File 'lib/zoho_sign/document/create_service.rb', line 56 def call connection.post('requests', **params) end |