hellosign-ruby-sdk 3.7.0 → 3.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,7 +32,6 @@ require 'hello_sign/api'
32
32
  require 'logger'
33
33
 
34
34
  module HelloSign
35
-
36
35
  #
37
36
  # You'll need the HelloSign::Client to do just about everything, from creating
38
37
  # signatures to updating account information.
@@ -69,11 +68,11 @@ module HelloSign
69
68
  }
70
69
 
71
70
  #
72
- # Creates a new HelloSign Client
71
+ # Initiates a new HelloSign Client
73
72
 
74
- # @option opts [String] email_address email address
75
- # @option opts [String] password password
76
- # @option opts [String] api_key Api key
73
+ # @option opts [String] email_address The account's email address. (optional)
74
+ # @option opts [String] password The account's password, if authenticating with an email_address. (optional)
75
+ # @option opts [String] api_key The account's API key.
77
76
  # @return [HelloSign::Client] a new HelloSign::Client
78
77
  def initialize(opts={})
79
78
  options = HelloSign.options.merge(opts)
@@ -83,9 +82,9 @@ module HelloSign
83
82
  end
84
83
 
85
84
  #
86
- # Make a http get request
87
- # @param path [String] relative path of the request
88
- # @option options [Hash] params params of the url
85
+ # Makes an HTTP GET request
86
+ # @param path [String] Relative path of the request.
87
+ # @option options [Hash] params Params of the URL.
89
88
  #
90
89
  def get(path, options={})
91
90
  response = request(path, :get, options)
@@ -95,10 +94,10 @@ module HelloSign
95
94
  end
96
95
 
97
96
  #
98
- # Make a http post request
99
- # @param path [String] relative path of the request
100
- # @option options [Hash] params params of the url
101
- # @option options [Hash] body request body
97
+ # Makes an HTTP POST request
98
+ # @param path [String] Relative path of the request.
99
+ # @option options [Hash] params Params of the URL.
100
+ # @option options [Hash] body Body of the request.
102
101
  #
103
102
  def post(path, options={})
104
103
  response = request(path, :post, options)
@@ -108,10 +107,10 @@ module HelloSign
108
107
  end
109
108
 
110
109
  #
111
- # Make a http put request
112
- # @param path [String] relative path of the request
113
- # @option options [Hash] params params of the url
114
- # @option options [Hash] body request body
110
+ # Makes an HTTP PUT request
111
+ # @param path [String] Relative path of the request.
112
+ # @option options [Hash] params Params of the URL.
113
+ # @option options [Hash] body Body of the request.
115
114
  #
116
115
  def put(path, options={})
117
116
  response = request(path, :put, options)
@@ -121,9 +120,9 @@ module HelloSign
121
120
  end
122
121
 
123
122
  #
124
- # Make a http delete request
125
- # @param path [String] relative path of the request
126
- # @option options [Hash] params params of the url
123
+ # Make an HTTP DELETE request
124
+ # @param path [String] Relative path of the request.
125
+ # @option options [Hash] Params of the URL.
127
126
  #
128
127
  def delete(path, options={})
129
128
  response = request(path, :delete, options)
@@ -160,6 +159,7 @@ module HelloSign
160
159
  faraday.adapter :net_http
161
160
  faraday.options[:timeout] = timeout if timeout
162
161
  end
162
+
163
163
  if options[:no_auth]
164
164
  elsif auth_token
165
165
  connection.authorization :Bearer, auth_token
@@ -183,9 +183,6 @@ module HelloSign
183
183
  if response.status >= 400
184
184
  error_class = ERRORS[response.status] || HelloSign::Error::UnknownError
185
185
  error = error_class.new(response.status, response.body, response.to_hash[:url].to_s)
186
- # error.response_status = response.status
187
- # error.response_body = response.body
188
- # error.request_uri = response.to_hash[:url].to_s
189
186
  raise error
190
187
  end
191
188
  end
@@ -204,7 +201,7 @@ module HelloSign
204
201
 
205
202
  def MIMEfromName(name)
206
203
  parts = name.split('.')
207
- #default to pdf if no extension
204
+ # defaults to pdf if no extension provided
208
205
  if parts.length < 2
209
206
  return 'application/pdf'
210
207
  end
@@ -299,21 +296,21 @@ module HelloSign
299
296
  if (opts[:form_fields_per_document] and opts[:form_fields_per_document].is_a? Array)
300
297
  opts[:form_fields_per_document] = MultiJson.dump(opts[:form_fields_per_document])
301
298
  end
302
- #ignore if it's already a string, or not present
299
+ # ignore if it's already a string, or not present
303
300
  end
304
301
 
305
302
  def prepare_custom_fields(opts)
306
303
  if (opts[:custom_fields] and opts[:custom_fields].is_a? Array)
307
304
  opts[:custom_fields] = MultiJson.dump(opts[:custom_fields])
308
305
  end
309
- #ignore if it's already a string, or not present
306
+ # ignore if it's already a string, or not present
310
307
  end
311
308
 
312
309
  def prepare_merge_fields(opts)
313
310
  if (opts[:merge_fields] and opts[:merge_fields].is_a? Array)
314
311
  opts[:merge_fields] = MultiJson.dump(opts[:merge_fields])
315
312
  end
316
- #ignore if it's already a string, or not present
313
+ # ignore if it's already a string, or not present
317
314
  end
318
315
 
319
316
  def prepare(opts, key)
@@ -23,7 +23,6 @@
23
23
  #
24
24
 
25
25
  module HelloSign
26
-
27
26
  #
28
27
  # Define config attributes and default values for HelloSign module
29
28
  #
@@ -1,8 +1,8 @@
1
1
  #
2
2
  # The MIT License (MIT)
3
- #
3
+ #
4
4
  # Copyright (C) 2014 hellosign.com
5
- #
5
+ #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the "Software"), to deal
8
8
  # in the Software without restriction, including without limitation the rights
@@ -24,22 +24,20 @@
24
24
 
25
25
  module HelloSign
26
26
  module Resource
27
-
28
27
  #
29
- # Contains information about an account and its settings.
30
- # Take a look at our {https://app.hellosign.com/api/reference#Account account resource document}
28
+ # Contains information about an Account and its settings.
29
+ # Take a look at our API Documentation on the Account resource (https://app.hellosign.com/api/reference#Account)
31
30
  # for more information about this.
32
31
  #
33
32
  # @author [hellosign]
34
33
  #
35
34
  class Account < BaseResource
36
-
37
35
  #
38
- # Create a new Account from a hash. If key defined then account data with be the value of hash[key], otherwise the hash itself
39
- # @param hash [Hash] account's data
40
- # @param key [String] (account) key of the hash, point to where account data is. If nil then the hash itself
36
+ # Creates a new Account from a hash. If key defined then account data with be the value of hash[key], otherwise the hash itself.
37
+ # @param hash [Hash] Account's data
38
+ # @param key [String] (account) key of the hash, point to where Account data is. If nil, then the hash itself.
41
39
  #
42
- # @return [HelloSign::Resource:Account] a Account resource
40
+ # @return [HelloSign::Resource:Account] an Account resource
43
41
  def initialize(hash, key='account')
44
42
  super
45
43
  end
@@ -24,20 +24,18 @@
24
24
 
25
25
  module HelloSign
26
26
  module Resource
27
-
28
27
  #
29
- # Contains information about an team and its members.
30
- # Take a look at our {https://app.hellosign.com/api/reference#ApiApp API Application resource document}
28
+ # Contains information about the ApiApp resource.
29
+ # Take a look at our API Documentation for ApiApps (https://app.hellosign.com/api/reference#ApiApp)
31
30
  # for more information about this.
32
31
  #
33
32
  # @author [hellosign]
34
33
  #
35
34
  class ApiApp < BaseResource
36
-
37
35
  #
38
- # create a new ApiApp from a hash. If a key is defined then team data with be the value of hash[key], otherwise the hash itself
39
- # @param hash [Hash] API Application data
40
- # @param key [String] (api_app) key of the hash, point to where API application data is. If nil then the hash itself
36
+ # Creates a new ApiApp from a hash. If a key is defined then ApiApp data with be the value of hash[key], otherwise the hash itself.
37
+ # @param hash [Hash] ApiApp data
38
+ # @param key [String] (api_app) key of the hash, point to where ApiApp data is. If nil, then the hash itself.
41
39
  #
42
40
  # @return [HelloSign::Resource:ApiApp] an ApiApp resource
43
41
  def initialize(hash, key='api_app')
@@ -24,21 +24,19 @@
24
24
 
25
25
  module HelloSign
26
26
  module Resource
27
-
28
27
  #
29
- # Store the value of a hash. Use missing_method to create method to access it like an object
28
+ # Stores the value of a hash. Use missing_method to create method to access it like an object
30
29
  #
31
30
  # @author [hellosign]
32
31
  #
33
32
  class BaseResource
34
33
 
35
34
  attr_reader :data, :raw_data, :warnings, :headers
36
-
37
35
  #
38
36
  # recursively convert hash data into BaseResource.
39
37
  #
40
- # @param hash [Hash] data of the resource
41
- # @param key [String] (nil) key of the hash, point to where resource data is. If nil then the hash itself
38
+ # @param hash [Hash] Data of the resource
39
+ # @param key [String] (nil) Key of the hash, point to where resource data is. If nil, then the hash itself.
42
40
  #
43
41
  # @return [HelloSign::Resource::BaseResource] a new BaseResource
44
42
  def initialize(hash, key=nil)
@@ -47,7 +45,7 @@ module HelloSign
47
45
  if hash[:body]
48
46
  @warnings = hash[:body]['warnings'] ? hash[:body]['warnings'] : nil
49
47
  end
50
-
48
+
51
49
  @data = @raw_data.inject({}) do |data, (key, value)|
52
50
  data[key.to_s] = if value.is_a? Hash
53
51
  value = BaseResource.new(value)
@@ -62,17 +60,15 @@ module HelloSign
62
60
 
63
61
  #
64
62
  # Magic method, give class dynamic methods based on hash keys.
65
- #
66
63
  # If initialized hash has a key which matches the method name, return value of that key.
67
- #
68
- # Otherwise, return nil
64
+ # Otherwise, return nil.
69
65
  #
70
66
  # @param method [Symbol] Method's name
71
67
  #
72
68
  # @example
73
- # resource = BaseResource.new :email_address => "me@example.com"
74
- # resource.email_address # => "me@example.com"
75
- # resource.not_in_hash_keys # => nil
69
+ # resource = BaseResource.new :email_address => "me@example.com"
70
+ # resource.email_address => "me@example.com"
71
+ # resource.not_in_hash_keys => nil
76
72
  def method_missing(method)
77
73
  @data.key?(method.to_s) ? @data[method.to_s] : nil
78
74
  end
@@ -1,8 +1,8 @@
1
1
  #
2
2
  # The MIT License (MIT)
3
- #
3
+ #
4
4
  # Copyright (C) 2014 hellosign.com
5
- #
5
+ #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the "Software"), to deal
8
8
  # in the Software without restriction, including without limitation the rights
@@ -24,22 +24,20 @@
24
24
 
25
25
  module HelloSign
26
26
  module Resource
27
-
28
27
  #
29
- # An object that contains necessary information to set up embedded signing.
30
- # Take a look at our {https://app.hellosign.com/api/reference#Embedded account resource document}
28
+ # An object that contains necessary information to set up Embedded signing.
29
+ # Take a look at our Embedded Signing Walkthrough (https://app.hellosign.com/api/embeddedSigningWalkthrough)
31
30
  # for more information about this.
32
31
  #
33
32
  # @author [hellosign]
34
33
  #
35
34
  class Embedded < BaseResource
36
-
37
35
  #
38
- # create a new Embedded resource from a hash. If a key is defined then embedded data with be the value of hash[key], otherwise the hash itself
39
- # @param hash [Hash] embedded's data
40
- # @param key [String] (embedded) key of the hash, point to where embedded data is. If nil then the hash itself
36
+ # create a new Embedded resource from a hash. If a key is defined then embedded data with be the value of hash[key], otherwise the hash itself.
37
+ # @param hash [Hash] Embedded's data
38
+ # @param key [String] (embedded) Key of the hash, point to where Embedded data is. If nil, then the hash itself.
41
39
  #
42
- # @return [HelloSign::Resource:Embedded] a Embedded resource
40
+ # @return [HelloSign::Resource:Embedded] an Embedded resource
43
41
  def initialize(hash, key='embedded')
44
42
  super
45
43
  end
@@ -24,7 +24,6 @@
24
24
 
25
25
  module HelloSign
26
26
  module Resource
27
-
28
27
  #
29
28
  # Stores an array of HelloSign BaseResource with paging information
30
29
  #
@@ -32,13 +31,12 @@ module HelloSign
32
31
  #
33
32
  class ResourceArray < Array
34
33
  attr_reader :page, :num_pages, :num_results, :page_size, :warnings, :headers, :list_info
35
-
36
34
  #
37
35
  # create a new ResourceArray from a hash
38
36
  #
39
- # @param hash [Hash] data of the array
40
- # @param key [String] key of the hash, point to where resource array data is
41
- # @param resource_class [Class] a Resource Class object inherited from BaseResource. Use the created array item from hash[key]
37
+ # @param hash [Hash] Data of the array.
38
+ # @param key [String] Key of the hash, point to where resource array data is.
39
+ # @param resource_class [Class] a ResourceClass object inherited from BaseResource. Uses the created array item from hash[key].
42
40
  #
43
41
  # @return [type] [description]
44
42
  def initialize(hash, key, resource_class)
@@ -1,8 +1,8 @@
1
1
  #
2
2
  # The MIT License (MIT)
3
- #
3
+ #
4
4
  # Copyright (C) 2014 hellosign.com
5
- #
5
+ #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the "Software"), to deal
8
8
  # in the Software without restriction, including without limitation the rights
@@ -24,21 +24,18 @@
24
24
 
25
25
  module HelloSign
26
26
  module Resource
27
-
28
27
  #
29
- # Contains information regarding documents that need to be signed
30
- # Take a look at our {https://app.hellosign.com/api/reference#SignatureRequest signature request resource document}
28
+ # Contains information regarding documents that need to be signed.
29
+ # Take a look at our API Documentation for sending Signature Requests (https://app.hellosign.com/api/reference#SignatureRequest)
31
30
  # for more information about this.
32
31
  #
33
32
  # @author [hellosign]
34
33
  #
35
34
  class SignatureRequest < BaseResource
36
-
37
- #
38
- # create a new SignatureRequest from a hash. If a key is defined then account data with be the value of hash[key], otherwise the hash itself
39
- # @param hash [Hash] signature request's data
40
- # @param key [String] (signature_request) key of the hash, point to where signature request data is. If nil then the hash itself
41
35
  #
36
+ # create a new SignatureRequest from a hash. If a key is defined then account data with be the value of hash[key], otherwise the hash itself.
37
+ # @param hash [Hash] SignatureRequest's data
38
+ # @param key [String] (signature_request) Key of the hash, point to where SignatureRequest data is. If nil, then the hash itself.
42
39
  #
43
40
  # @return [HelloSign::Resource::SignatureRequest] a SignatureRequest resource
44
41
  def initialize(hash, key='signature_request')
@@ -1,8 +1,8 @@
1
1
  #
2
2
  # The MIT License (MIT)
3
- #
3
+ #
4
4
  # Copyright (C) 2014 hellosign.com
5
- #
5
+ #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the "Software"), to deal
8
8
  # in the Software without restriction, including without limitation the rights
@@ -24,20 +24,18 @@
24
24
 
25
25
  module HelloSign
26
26
  module Resource
27
-
28
27
  #
29
- # Contains information about an team and its members.
30
- # Take a look at our {https://app.hellosign.com/api/reference#Team team resource document}
28
+ # Contains information about a Team and its members.
29
+ # Take a look at our API Documentation on the Team Resource (https://app.hellosign.com/api/reference#Team)
31
30
  # for more information about this.
32
31
  #
33
32
  # @author [hellosign]
34
33
  #
35
34
  class Team < BaseResource
36
-
37
35
  #
38
- # create a new Team from a hash. If a key is defined then team data with be the value of hash[key], otherwise the hash itself
39
- # @param hash [Hash] team's data
40
- # @param key [String] (team) key of the hash, point to where team data is. If nil then the hash itself
36
+ # Creates a new Team from a hash. If a key is defined then team data with be the value of hash[key], otherwise the hash itself.
37
+ # @param hash [Hash] Team's data
38
+ # @param key [String] (team) Key of the hash, point to where Team data is. If nil, then the hash itself.
41
39
  #
42
40
  # @return [HelloSign::Resource:Team] a Team resource
43
41
  def initialize(hash, key='team')
@@ -1,8 +1,8 @@
1
1
  #
2
2
  # The MIT License (MIT)
3
- #
3
+ #
4
4
  # Copyright (C) 2014 hellosign.com
5
- #
5
+ #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the "Software"), to deal
8
8
  # in the Software without restriction, including without limitation the rights
@@ -24,22 +24,20 @@
24
24
 
25
25
  module HelloSign
26
26
  module Resource
27
-
28
27
  #
29
28
  # Contains information about the templates you and your team have created
30
- # Take a look at our {https://app.hellosign.com/api/reference#Template Template resource document}
29
+ # Take a look at our API Documentation for Templates (https://app.hellosign.com/api/reference#Template)
31
30
  # for more information about this.
32
31
  #
33
32
  # @author [hellosign]
34
33
  #
35
34
  class Template < BaseResource
36
-
37
35
  #
38
- # create a new Template from a hash. If a key is defined then template data will be the value of hash[key], otherwise the hash itself
39
- # @param hash [Hash] template's data
40
- # @param key [String] (template) key of the hash, point to where template data is. If nil then the hash itself
36
+ # Creates a new Template from a hash. If a key is defined then template data will be the value of hash[key], otherwise the hash itself.
37
+ # @param hash [Hash] Template's data
38
+ # @param key [String] (template) Key of the hash, point to where Template data is. If nil, then the hash itself.
41
39
  #
42
- # @return [HelloSign::Resource:Team] a Team resource
40
+ # @return [HelloSign::Resource:Team] a Template resource
43
41
  def initialize(hash, key='template')
44
42
  super
45
43
  end
@@ -1,8 +1,8 @@
1
1
  #
2
2
  # The MIT License (MIT)
3
- #
3
+ #
4
4
  # Copyright (C) 2014 hellosign.com
5
- #
5
+ #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the "Software"), to deal
8
8
  # in the Software without restriction, including without limitation the rights
@@ -24,20 +24,18 @@
24
24
 
25
25
  module HelloSign
26
26
  module Resource
27
-
28
27
  #
29
- # A group of documents that a user can take ownership of by going to the claim URL
30
- # Take a look at our {https://app.hellosign.com/api/reference}
28
+ # A group of documents that a user can take ownership of by going to the claim_url.
29
+ # Take a look at our API Documentation for Templates (https://app.hellosign.com/api/reference#Template)
31
30
  # for more information about this.
32
31
  #
33
32
  # @author [hellosign]
34
33
  #
35
34
  class TemplateDraft < BaseResource
36
-
37
35
  #
38
- # create a new TemplateDraft from a hash. If a key is defined then template draft data will be the value of hash[key], otherwise the hash itself
39
- # @param hash [Hash] template draft's data
40
- # @param key [String] (template_draft) key of the hash, point to where template draft data is. If nil then the hash itself
36
+ # Creates a new TemplateDraft from a hash. If a key is defined then TemplateDraft data will be the value of hash[key], otherwise the hash itself.
37
+ # @param hash [Hash] TemplateDraft's data
38
+ # @param key [String] (template_draft) Key of the hash, point to where TemplateDraft data is. If nil, then the hash itself.
41
39
  #
42
40
  # @return [HelloSign::Resource:Team] a Team resource
43
41
  def initialize(hash, key='template')