Module: HelloSign::Api::ApiApp

Included in:
Client
Defined in:
lib/hello_sign/api/api_app.rb

Overview

Contains all the API calls for the ApiApp resource. Take a look at our API Documentation on ApiApps (app.hellosign.com/api/reference#ApiApp) for more information about this.

Author:

  • hellosign

Instance Method Summary collapse

Instance Method Details

#create_api_app(opts) ⇒ HelloSign::Resource::ApiApp

Creates a new ApiApp on your Account

Examples:

app = @client.create_api_app(
  name: 'My Production App',
  domain: 'example.com',
  'oauth[callback_url]': 'https://example.com/oauth',
  'oauth[scopes]': 'basic_account_info,request_signature'
)

Parameters:

  • opts (Hash)

    a customizable set of options

Options Hash (opts):

  • name (String)

    The name assigned to the ApiApp.

  • domain (String)

    The domain associated with the ApiApp.

  • callback_url (String)

    The URL that will receive callback events for the ApiApp. (optional)

  • custom_logo_file (String)

    An image file to use as a custom logo in embedded workflows, if available in the API subscription. (optional)

  • oauth[callback_url] (String)

    The callback URL to be used for OAuth flows. (optional)

  • oauth[scopes] (String)

    A comma-separated list of OAuth scopes to be granted to the app. (optional)

  • white_labeling_options (String<Hash>)

    Object with elements and values serialized to a string to customize the signer page, if available in the API subscription. (optional)

  • options[can_insert_everywhere] (Boolean)

    Determines if signers can “Insert Everywhere” when signing a document. (optional)

Returns:



78
79
80
# File 'lib/hello_sign/api/api_app.rb', line 78

def create_api_app(opts)
  HelloSign::Resource::ApiApp.new post('/api_app', body: opts)
end

#delete_api_app(opts) ⇒ HTTP::Status

Deletes an ApiApp. Only available for ApiApps you own.

Examples:

response = @client.delete_api_app client_id: 'fa5c8a0b0f492d768749333ad6fcc214c111e967'

Parameters:

  • opts (Hash)

    a customizable set of options

Options Hash (opts):

  • client_id (String)

    The Client ID of the ApiApp you want to delete.

Returns:

  • (HTTP::Status)

    204 No Content



115
116
117
118
# File 'lib/hello_sign/api/api_app.rb', line 115

def delete_api_app(opts)
  path = '/api_app/' + opts[:client_id]
  delete(path)
end

#get_api_app(opts) ⇒ HelloSign::Resource::ApiApp

Retrieves an ApiApp with a given ID

Examples:

app = @client.get_api_app client_id: 'fa5c8a0b0f492d768749333ad6fcc214c111e967'

Parameters:

  • opts (Hash)

    a customizable set of options

Options Hash (opts):

  • client_id (String)

    The Client ID of the ApiApp.

Returns:



40
41
42
# File 'lib/hello_sign/api/api_app.rb', line 40

def get_api_app(opts)
  HelloSign::Resource::ApiApp.new get("/api_app/#{opts[:client_id]}")
end

#get_api_apps(opts = {}) ⇒ HelloSign::Resource::ResourceArray

Returns a list of ApiApps that your Account can access.

Examples:

apps = @client.get_api_apps page: 1

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • page (Integer)

    Sets the page number of the list to return. Defaults to 1. (optional)

  • page_size (Integer)

    Determines the number of ApiApps returned per page. Defaults to 20. (optional)

Returns:



52
53
54
55
56
57
# File 'lib/hello_sign/api/api_app.rb', line 52

def get_api_apps(opts={})
  path = '/api_app/list'
  path += opts[:page] ? "?page=#{opts[:page]}" : ''
  path += opts[:page_size] ? "&page_size=#{opts[:page_size]}" : ''
  HelloSign::Resource::ResourceArray.new get(path, opts), 'api_apps',  HelloSign::Resource::ApiApp
end

#update_api_app(opts) ⇒ HelloSign::Resource::ApiApp

Updates the ApiApp settings.

Examples:

app = @client.update_api_app(
  name: 'My Newly Renamed App',
  domain: 'example2.com',
  'oauth[callback_url]': 'https://example2.com/oauth',
  'oauth[scopes]': 'basic_account_info, request_signature'
)

Parameters:

  • opts (Hash)

    a customizable set of options

Options Hash (opts):

  • client_id (String)

    The Client ID of the ApiApp you want to update.

  • name (String)

    The name assigned to the ApiApp. (optional)

  • domain (String)

    The domain associated with the ApiApp. (optional)

  • callback_url (String)

    The URL that will receive callback events for the ApiApp. (optional)

  • custom_logo_file (String)

    An image file to use as a custom logo in embedded workflows, if available in the API subscription. (optional)

  • oauth[callback_url] (String)

    The callback URL to be used for OAuth flows. (optional)

  • oauth[scopes] (String)

    A comma-separated list of OAuth scopes to be granted to the app. (optional)

  • white_labeling_options (String<Hash>)

    Object with elements and values serialized to a string to customize the signer page, if available in the API subscription. (optional)

  • options[can_insert_everywhere] (Boolean)

    Determines if signers can “Insert Everywhere” when signing a document. (optional)

Returns:



102
103
104
105
106
# File 'lib/hello_sign/api/api_app.rb', line 102

def update_api_app(opts)
  id = opts.delete(:client_id)
  path = '/api_app/' + id
  HelloSign::Resource::ApiApp.new post(path, body: opts)
end