Class: HelloSign::Client

Inherits:
Object
  • Object
show all
Includes:
Api::Account, Api::ApiApp, Api::Embedded, Api::OAuth, Api::SignatureRequest, Api::Team, Api::Template, Api::UnclaimedDraft
Defined in:
lib/hello_sign/client.rb

Overview

You’ll need the HelloSign::Client to do just about everything, from creating signatures to updating account information.

Examples:

client = HelloSign::Client.new :email_address => "[email protected]", :password => "mypassword"

Author:

  • hellosign

Constant Summary collapse

ERRORS =
{
  400 => Error::BadRequest,
  401 => Error::Unauthorized,
  402 => Error::PaidApiPlanRequired,
  403 => Error::Forbidden,
  404 => Error::NotFound,
  405 => Error::MethodNotAllowed,
  409 => Error::Conflict,
  410 => Error::Gone,
  429 => Error::ExceededRate,
  500 => Error::InternalServerError,
  502 => Error::BadGateway,
  503 => Error::ServiceUnavailable
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Api::ApiApp

#create_api_app, #delete_api_app, #get_api_app, #get_api_apps, #update_api_app

Methods included from Api::OAuth

#get_oauth_token, #oauth_create_account, #oauth_url, #refresh_oauth_token

Methods included from Api::Embedded

#get_embedded_sign_url, #get_embedded_template_edit_url

Methods included from Api::UnclaimedDraft

#create_embedded_unclaimed_draft, #create_embedded_unclaimed_draft_with_template, #create_unclaimed_draft, #edit_and_resend_unclaimed_draft

Methods included from Api::Team

#add_member_to_team, #create_team, #destroy_team, #get_team, #remove_member_from_team, #update_team

Methods included from Api::Template

#add_user_to_template, #create_embedded_template_draft, #delete_template, #get_template, #get_template_files, #get_templates, #remove_user_from_template, #update_template_files

Methods included from Api::SignatureRequest

#cancel_signature_request, #create_embedded_signature_request, #create_embedded_signature_request_with_template, #get_signature_request, #get_signature_requests, #remind_signature_request, #remove_signature_request, #send_signature_request, #send_signature_request_with_template, #signature_request_files, #update_signature_request

Methods included from Api::Account

#create_account, #get_account, #update_account, #verify

Constructor Details

#initialize(opts = {}) ⇒ HelloSign::Client

Returns a new HelloSign::Client.

Parameters:

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

    a customizable set of options

Options Hash (opts):

  • email_address (String)

    The account’s email address. (optional)

  • password (String)

    The account’s password, if authenticating with an email_address. (optional)

  • api_key (String)

    The account’s API key.



77
78
79
80
81
82
# File 'lib/hello_sign/client.rb', line 77

def initialize(opts={})
  options = HelloSign.options.merge(opts)
  HelloSign::Configuration::VALID_OPTIONS_KEYS.each do |key|
    self.send("#{key}=", options[key])
  end
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



53
54
55
# File 'lib/hello_sign/client.rb', line 53

def api_key
  @api_key
end

#api_versionObject

Returns the value of attribute api_version.



53
54
55
# File 'lib/hello_sign/client.rb', line 53

def api_version
  @api_version
end

#auth_tokenObject

Returns the value of attribute auth_token.



53
54
55
# File 'lib/hello_sign/client.rb', line 53

def auth_token
  @auth_token
end

#client_idObject

Returns the value of attribute client_id.



53
54
55
# File 'lib/hello_sign/client.rb', line 53

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret.



53
54
55
# File 'lib/hello_sign/client.rb', line 53

def client_secret
  @client_secret
end

#email_addressObject

Returns the value of attribute email_address.



53
54
55
# File 'lib/hello_sign/client.rb', line 53

def email_address
  @email_address
end

#end_pointObject

Returns the value of attribute end_point.



53
54
55
# File 'lib/hello_sign/client.rb', line 53

def end_point
  @end_point
end

#log_levelObject

Returns the value of attribute log_level.



53
54
55
# File 'lib/hello_sign/client.rb', line 53

def log_level
  @log_level
end

#loggingObject

Returns the value of attribute logging.



53
54
55
# File 'lib/hello_sign/client.rb', line 53

def logging
  @logging
end

#oauth_end_pointObject

Returns the value of attribute oauth_end_point.



53
54
55
# File 'lib/hello_sign/client.rb', line 53

def oauth_end_point
  @oauth_end_point
end

#passwordObject

Returns the value of attribute password.



53
54
55
# File 'lib/hello_sign/client.rb', line 53

def password
  @password
end

#proxy_passObject

Returns the value of attribute proxy_pass.



53
54
55
# File 'lib/hello_sign/client.rb', line 53

def proxy_pass
  @proxy_pass
end

#proxy_uriObject

Returns the value of attribute proxy_uri.



53
54
55
# File 'lib/hello_sign/client.rb', line 53

def proxy_uri
  @proxy_uri
end

#proxy_userObject

Returns the value of attribute proxy_user.



53
54
55
# File 'lib/hello_sign/client.rb', line 53

def proxy_user
  @proxy_user
end

#timeoutObject

Returns the value of attribute timeout.



53
54
55
# File 'lib/hello_sign/client.rb', line 53

def timeout
  @timeout
end

#user_agentObject

Returns the value of attribute user_agent.



53
54
55
# File 'lib/hello_sign/client.rb', line 53

def user_agent
  @user_agent
end

Instance Method Details

#delete(path, options = {}) ⇒ Object

Make an HTTP DELETE request

Parameters:

  • path (String)

    Relative path of the request.

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

    a customizable set of options

Options Hash (options):

  • Params (Hash)

    of the URL.



127
128
129
130
131
132
# File 'lib/hello_sign/client.rb', line 127

def delete(path, options={})
  response = request(path, :delete, options)
  validate response
  parsed_response = parse response
  data = { headers: response.headers, body: parsed_response }
end

#get(path, options = {}) ⇒ Object

Makes an HTTP GET request

Parameters:

  • path (String)

    Relative path of the request.

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

    a customizable set of options

Options Hash (options):

  • params (Hash)

    Params of the URL.



89
90
91
92
93
94
# File 'lib/hello_sign/client.rb', line 89

def get(path, options={})
  response = request(path, :get, options)
  validate response
  parsed_response = parse response
  data = { headers: response.headers, body: parsed_response }
end

#post(path, options = {}) ⇒ Object

Makes an HTTP POST request

Parameters:

  • path (String)

    Relative path of the request.

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

    a customizable set of options

Options Hash (options):

  • params (Hash)

    Params of the URL.

  • body (Hash)

    Body of the request.



102
103
104
105
106
107
# File 'lib/hello_sign/client.rb', line 102

def post(path, options={})
  response = request(path, :post, options)
  validate response
  parsed_response = parse response
  data = { headers: response.headers, body: parsed_response }
end

#put(path, options = {}) ⇒ Object

Makes an HTTP PUT request

Parameters:

  • path (String)

    Relative path of the request.

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

    a customizable set of options

Options Hash (options):

  • params (Hash)

    Params of the URL.

  • body (Hash)

    Body of the request.



115
116
117
118
119
120
# File 'lib/hello_sign/client.rb', line 115

def put(path, options={})
  response = request(path, :put, options)
  validate response
  responsed_response = parse response
  data = { headers: response.headers, body: parsed_response }
end