hellosign-api 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rspec +2 -0
- data/.travis.yml +15 -0
- data/CONTRIBUTING.md +42 -0
- data/Gemfile +13 -0
- data/Guardfile +14 -0
- data/LICENSE +21 -0
- data/README.md +112 -0
- data/Rakefile +16 -0
- data/hellosign-api.gemspec +54 -0
- data/lib/hello_sign/.error.rb.swp +0 -0
- data/lib/hello_sign/api/account.rb +78 -0
- data/lib/hello_sign/api/api_app.rb +121 -0
- data/lib/hello_sign/api/bulk_send_job.rb +62 -0
- data/lib/hello_sign/api/embedded.rb +68 -0
- data/lib/hello_sign/api/oauth.rb +95 -0
- data/lib/hello_sign/api/signature_request.rb +691 -0
- data/lib/hello_sign/api/team.rb +107 -0
- data/lib/hello_sign/api/template.rb +227 -0
- data/lib/hello_sign/api/unclaimed_draft.rb +328 -0
- data/lib/hello_sign/api.rb +31 -0
- data/lib/hello_sign/client.rb +372 -0
- data/lib/hello_sign/configuration.rb +78 -0
- data/lib/hello_sign/error.rb +99 -0
- data/lib/hello_sign/resource/account.rb +43 -0
- data/lib/hello_sign/resource/api_app.rb +43 -0
- data/lib/hello_sign/resource/base_resource.rb +73 -0
- data/lib/hello_sign/resource/bulk_send_job.rb +43 -0
- data/lib/hello_sign/resource/embedded.rb +43 -0
- data/lib/hello_sign/resource/resource_array.rb +56 -0
- data/lib/hello_sign/resource/signature_request.rb +43 -0
- data/lib/hello_sign/resource/team.rb +43 -0
- data/lib/hello_sign/resource/template.rb +43 -0
- data/lib/hello_sign/resource/template_draft.rb +44 -0
- data/lib/hello_sign/resource/unclaimed_draft.rb +44 -0
- data/lib/hello_sign/resource.rb +33 -0
- data/lib/hello_sign/version.rb +25 -0
- data/lib/hello_sign.rb +50 -0
- data/lib/hellosign-ruby-sdk.rb +4 -0
- data/spec/fixtures/account.json +15 -0
- data/spec/fixtures/api_app.json +16 -0
- data/spec/fixtures/api_apps.json +43 -0
- data/spec/fixtures/bulk_send_job.json +88 -0
- data/spec/fixtures/bulk_send_jobs.json +22 -0
- data/spec/fixtures/embedded.json +6 -0
- data/spec/fixtures/empty.pdf +0 -0
- data/spec/fixtures/error.json +6 -0
- data/spec/fixtures/file.json +0 -0
- data/spec/fixtures/headers.json +18 -0
- data/spec/fixtures/nda.pdf +0 -0
- data/spec/fixtures/signature_request.json +45 -0
- data/spec/fixtures/signature_requests.json +44 -0
- data/spec/fixtures/team.json +15 -0
- data/spec/fixtures/template.json +53 -0
- data/spec/fixtures/templates.json +59 -0
- data/spec/fixtures/token.json +14 -0
- data/spec/fixtures/unclaimed_draft.json +6 -0
- data/spec/hello_sign/.error_spec.rb.swp +0 -0
- data/spec/hello_sign/api/account_spec.rb +42 -0
- data/spec/hello_sign/api/api_app_spec.rb +104 -0
- data/spec/hello_sign/api/bulk_send_job_spec.rb +53 -0
- data/spec/hello_sign/api/embedded_spec.rb +23 -0
- data/spec/hello_sign/api/oauth_spec.rb +27 -0
- data/spec/hello_sign/api/signature_request_spec.rb +268 -0
- data/spec/hello_sign/api/team_spec.rb +101 -0
- data/spec/hello_sign/api/template_spec.rb +172 -0
- data/spec/hello_sign/api/unclaimed_draft_spec.rb +145 -0
- data/spec/hello_sign/client_spec.rb +191 -0
- data/spec/hello_sign/error_spec.rb +10 -0
- data/spec/hello_sign/resource/base_resource_spec.rb +53 -0
- data/spec/hello_sign_spec.rb +57 -0
- data/spec/scenarios/uploads_spec.rb +19 -0
- data/spec/spec_helper.rb +104 -0
- metadata +261 -0
@@ -0,0 +1,73 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 hellosign.com
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
module HelloSign
|
24
|
+
module Resource
|
25
|
+
# Stores the value of a hash. Use missing_method to create method to access it like an object
|
26
|
+
#
|
27
|
+
# @author [hellosign]
|
28
|
+
|
29
|
+
class BaseResource
|
30
|
+
|
31
|
+
attr_reader :data, :raw_data, :warnings, :headers
|
32
|
+
|
33
|
+
# Converts hash data recursively into BaseResource.
|
34
|
+
#
|
35
|
+
# @param hash [Hash] Data of the resource
|
36
|
+
# @param key [String] (nil) Key of the hash, point to where resource data is. If nil, then the hash itself.
|
37
|
+
#
|
38
|
+
# @return [HelloSign::Resource::BaseResource] a new BaseResource
|
39
|
+
def initialize(hash, key=nil)
|
40
|
+
@headers = hash[:headers]
|
41
|
+
@raw_data = key ? hash[:body][key] : hash
|
42
|
+
if hash[:body]
|
43
|
+
@warnings = hash[:body]['warnings'] ? hash[:body]['warnings'] : nil
|
44
|
+
end
|
45
|
+
|
46
|
+
@data = @raw_data.inject({}) do |data, (key, value)|
|
47
|
+
data[key.to_s] = if value.is_a? Hash
|
48
|
+
value = BaseResource.new(value)
|
49
|
+
elsif ((value.is_a? Array) && (value[0].is_a? Hash))
|
50
|
+
value = value.map {|v| BaseResource.new(v)}
|
51
|
+
else
|
52
|
+
value
|
53
|
+
end
|
54
|
+
data
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Magic method, gives class dynamic methods based on hash keys.
|
59
|
+
# If initialized hash has a key which matches the method name, return value of that key.
|
60
|
+
# Otherwise, return nil.
|
61
|
+
#
|
62
|
+
# @param method [Symbol] Method's name
|
63
|
+
#
|
64
|
+
# @example
|
65
|
+
# resource = BaseResource.new email_address: "me@example.com"
|
66
|
+
# resource.email_address => "me@example.com"
|
67
|
+
# resource.not_in_hash_keys => nil
|
68
|
+
def method_missing(method)
|
69
|
+
@data.key?(method.to_s) ? @data[method.to_s] : nil
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 hellosign.com
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
module HelloSign
|
24
|
+
module Resource
|
25
|
+
# Contains information about a BulkSendJob.
|
26
|
+
# Take a look at our API Documentation on BulkSendJobs (https://app.hellosign.com/api/reference#BulkSendJob)
|
27
|
+
# for more information about this.
|
28
|
+
#
|
29
|
+
# @author [hellosign]
|
30
|
+
|
31
|
+
class BulkSendJob < BaseResource
|
32
|
+
|
33
|
+
# Creates a new BulkSendJob from a hash. If a key is defined then account data with be the value of hash[key], otherwise the hash itself.
|
34
|
+
# @param hash [Hash] BulkSendJob's data
|
35
|
+
# @param key [String] (bulk_send_job) Key of the hash, point to where BulkSendJob data is. If nil, then the hash itself.
|
36
|
+
#
|
37
|
+
# @return [HelloSign::Resource::BulkSendJob] a BulkSendJob
|
38
|
+
def initialize(hash, key='bulk_send_job')
|
39
|
+
super
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 hellosign.com
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
module HelloSign
|
24
|
+
module Resource
|
25
|
+
# Contains information about Embedded workflows.
|
26
|
+
# Take a look at our Embedded Signing Walkthrough (https://app.hellosign.com/api/embeddedSigningWalkthrough)
|
27
|
+
# for more information about this.
|
28
|
+
#
|
29
|
+
# @author [hellosign]
|
30
|
+
|
31
|
+
class Embedded < BaseResource
|
32
|
+
|
33
|
+
# Creates 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.
|
34
|
+
# @param hash [Hash] Embedded's data
|
35
|
+
# @param key [String] (embedded) Key of the hash, point to where Embedded data is. If nil, then the hash itself.
|
36
|
+
#
|
37
|
+
# @return [HelloSign::Resource::Embedded] an Embedded resource
|
38
|
+
def initialize(hash, key='embedded')
|
39
|
+
super
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 hellosign.com
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
module HelloSign
|
24
|
+
module Resource
|
25
|
+
# Stores an array of HelloSign BaseResource with paging information
|
26
|
+
#
|
27
|
+
# @author [hellosign]
|
28
|
+
|
29
|
+
class ResourceArray < Array
|
30
|
+
attr_reader :page, :num_pages, :num_results, :page_size, :warnings, :headers, :list_info, :data
|
31
|
+
|
32
|
+
# Creates a new ResourceArray from a hash
|
33
|
+
#
|
34
|
+
# @param hash [Hash] Data of the array.
|
35
|
+
# @param key [String] Key of the hash, point to where resource array data is.
|
36
|
+
# @param resource_class [Class] a ResourceClass object inherited from BaseResource. Uses the created array item from hash[key].
|
37
|
+
#
|
38
|
+
# @return [HelloSign::Resource::ResourceArray] a ResourceArray
|
39
|
+
def initialize(hash, key, resource_class)
|
40
|
+
@headers = hash[:headers]
|
41
|
+
@data = hash[:body]
|
42
|
+
@list_info = hash[:body]['list_info']
|
43
|
+
@page = @list_info['page']
|
44
|
+
@num_pages = @list_info['num_pages']
|
45
|
+
@num_results = @list_info['num_results']
|
46
|
+
@page_size = @list_info['page_size']
|
47
|
+
@warnings = hash[:body]['warnings'] ? hash[:body]['warnings'] : nil
|
48
|
+
self << resource_class.new(hash[:body], nil)
|
49
|
+
|
50
|
+
hash[key] && hash[key].each do |resource|
|
51
|
+
self << resource_class.new(resource, nil)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 hellosign.com
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
module HelloSign
|
24
|
+
module Resource
|
25
|
+
# Contains information about a SignatureRequest.
|
26
|
+
# Take a look at our API Documentation for Signature Requests (https://app.hellosign.com/api/reference#SignatureRequest)
|
27
|
+
# for more information about this.
|
28
|
+
#
|
29
|
+
# @author [hellosign]
|
30
|
+
|
31
|
+
class SignatureRequest < BaseResource
|
32
|
+
|
33
|
+
# Creates 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.
|
34
|
+
# @param hash [Hash] SignatureRequest's data
|
35
|
+
# @param key [String] (signature_request) Key of the hash, point to where SignatureRequest data is. If nil, then the hash itself.
|
36
|
+
#
|
37
|
+
# @return [HelloSign::Resource::SignatureRequest] a SignatureRequest
|
38
|
+
def initialize(hash, key='signature_request')
|
39
|
+
super
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 hellosign.com
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
module HelloSign
|
24
|
+
module Resource
|
25
|
+
# Contains information about a Team and its members.
|
26
|
+
# Take a look at our API Documentation on the Team Resource (https://app.hellosign.com/api/reference#Team)
|
27
|
+
# for more information about this.
|
28
|
+
#
|
29
|
+
# @author [hellosign]
|
30
|
+
|
31
|
+
class Team < BaseResource
|
32
|
+
|
33
|
+
# 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.
|
34
|
+
# @param hash [Hash] Team's data
|
35
|
+
# @param key [String] (team) Key of the hash, point to where Team data is. If nil, then the hash itself.
|
36
|
+
#
|
37
|
+
# @return [HelloSign::Resource::Team] a Team
|
38
|
+
def initialize(hash, key='team')
|
39
|
+
super
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 hellosign.com
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
module HelloSign
|
24
|
+
module Resource
|
25
|
+
# Contains information about Templates.
|
26
|
+
# Take a look at our API Documentation for Templates (https://app.hellosign.com/api/reference#Template)
|
27
|
+
# for more information about this.
|
28
|
+
#
|
29
|
+
# @author [hellosign]
|
30
|
+
|
31
|
+
class Template < BaseResource
|
32
|
+
|
33
|
+
# 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.
|
34
|
+
# @param hash [Hash] Template's data
|
35
|
+
# @param key [String] (template) Key of the hash, point to where Template data is. If nil, then the hash itself.
|
36
|
+
#
|
37
|
+
# @return [HelloSign::Resource::Template] a Template
|
38
|
+
def initialize(hash, key='template')
|
39
|
+
super
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 hellosign.com
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
module HelloSign
|
24
|
+
module Resource
|
25
|
+
# Contains information about a TemplateDraft.
|
26
|
+
# Take a look at our API Documentation for Templates (https://app.hellosign.com/api/reference#Template)
|
27
|
+
# for more information about this.
|
28
|
+
#
|
29
|
+
# @author [hellosign]
|
30
|
+
|
31
|
+
class TemplateDraft < BaseResource
|
32
|
+
|
33
|
+
# 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.
|
34
|
+
# @param hash [Hash] TemplateDraft's data
|
35
|
+
# @param key [String] (template_draft) Key of the hash, point to where TemplateDraft data is. If nil, then the hash itself.
|
36
|
+
#
|
37
|
+
# @return [HelloSign::Resource::TemplateDraft] a TemplateDraft
|
38
|
+
def initialize(hash, key='template')
|
39
|
+
super
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 hellosign.com
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
module HelloSign
|
24
|
+
module Resource
|
25
|
+
# Contains information about an UnclaimedDraft.
|
26
|
+
# Take a look at our API documentation for the UnclaimedDraft resource (https://app.hellosign.com/api/reference#UnclaimedDraft)
|
27
|
+
# for more information about this.
|
28
|
+
#
|
29
|
+
# @author [hellosign]
|
30
|
+
|
31
|
+
class UnclaimedDraft < BaseResource
|
32
|
+
|
33
|
+
# Creates a new UnclaimedDraft from a hash. If a key is defined then UnclaimedDraft data with be the value of hash[key], otherwise the hash itself.
|
34
|
+
# @param hash [Hash] UnclaimedDraft's data
|
35
|
+
# @param key [String] (unclaimed_draft) Key of the hash, point to where UnclaimedDraft data is. If nil, then the hash itself.
|
36
|
+
#
|
37
|
+
# @return [HelloSign::Resource::UnclaimedDraft] an UnclaimedDraft
|
38
|
+
def initialize(hash, key='unclaimed_draft')
|
39
|
+
super
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 hellosign.com
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'hello_sign/resource/base_resource'
|
24
|
+
require 'hello_sign/resource/resource_array'
|
25
|
+
require 'hello_sign/resource/template_draft'
|
26
|
+
require 'hello_sign/resource/account'
|
27
|
+
require 'hello_sign/resource/embedded'
|
28
|
+
require 'hello_sign/resource/template'
|
29
|
+
require 'hello_sign/resource/signature_request'
|
30
|
+
require 'hello_sign/resource/team'
|
31
|
+
require 'hello_sign/resource/unclaimed_draft'
|
32
|
+
require 'hello_sign/resource/api_app'
|
33
|
+
require 'hello_sign/resource/bulk_send_job'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 hellosign.com
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
module HelloSign
|
24
|
+
VERSION = '1.0.0'
|
25
|
+
end
|
data/lib/hello_sign.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 hellosign.com
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'hello_sign/version'
|
24
|
+
require 'hello_sign/configuration'
|
25
|
+
require 'hello_sign/client'
|
26
|
+
|
27
|
+
module HelloSign
|
28
|
+
extend Configuration
|
29
|
+
|
30
|
+
# If HelloSign module doesn't respond to method, then delegates it to HelloSign::Client
|
31
|
+
# @param method [Symbol] method name
|
32
|
+
# @param *args [Array] arguments passed into the method
|
33
|
+
# @param &block [Block] a block passed into the method
|
34
|
+
def self.method_missing(method, *args, &block)
|
35
|
+
return super unless client.respond_to?(method)
|
36
|
+
client.send(method, *args, &block)
|
37
|
+
end
|
38
|
+
|
39
|
+
# If HelloSign module doesn't respond to method, asks HelloSign::Client whether it responded or not
|
40
|
+
# @param method [Symbol] method name
|
41
|
+
def self.respond_to?(method, include_all=false)
|
42
|
+
return super || client.respond_to?(method)
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def self.client
|
48
|
+
HelloSign::Client.new
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"account": {
|
3
|
+
"account_id": "123456789",
|
4
|
+
"email_address": "test@example.com",
|
5
|
+
"is_paid_hs": false,
|
6
|
+
"is_paid_hf": false,
|
7
|
+
"quotas": {
|
8
|
+
"templates_left": 0,
|
9
|
+
"documents_left": 0,
|
10
|
+
"api_signature_requests_left": 0
|
11
|
+
},
|
12
|
+
"callback_url": "https://example.com",
|
13
|
+
"role_code": ""
|
14
|
+
}
|
15
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
|
3
|
+
"api_app": {
|
4
|
+
"client_id": "5e365c014bea2e9a05a9d0834f3e7ca4",
|
5
|
+
"created_at": 1438030211,
|
6
|
+
"name": "Hodor",
|
7
|
+
"domain": "hodor.com",
|
8
|
+
"callback_url": null,
|
9
|
+
"owner_account": {
|
10
|
+
"account_id": "626e28a7781d6d12bd830220488a45e9ef3378ab",
|
11
|
+
"email_address": "hello@example.com"
|
12
|
+
},
|
13
|
+
"is_approved": false,
|
14
|
+
"oauth": null
|
15
|
+
}
|
16
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
{
|
2
|
+
"api_apps": [
|
3
|
+
{
|
4
|
+
"callback_url": null,
|
5
|
+
"client_id": "0dd3b823a682527788c4e40cb7b6f7e9",
|
6
|
+
"created_at": 1436232339,
|
7
|
+
"domain": "example.com",
|
8
|
+
"is_approved": true,
|
9
|
+
"name": "My Production App",
|
10
|
+
"oauth": {
|
11
|
+
"callback_url": "http://example.com/oauth",
|
12
|
+
"scopes": [
|
13
|
+
"basic_account_info",
|
14
|
+
"request_signature"
|
15
|
+
],
|
16
|
+
"secret": "98891a1b59f312d04cd88e4e0c498d75"
|
17
|
+
},
|
18
|
+
"owner_account": {
|
19
|
+
"account_id": "dc5deeb9e10b044c591ef2475aafad1d1d3bd888",
|
20
|
+
"email_address": "john@example.com"
|
21
|
+
}
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"callback_url": null,
|
25
|
+
"client_id": "bff6d867fafcca27554cf89b1ca98793",
|
26
|
+
"created_at": 1433458421,
|
27
|
+
"domain": "example.com",
|
28
|
+
"is_approved": false,
|
29
|
+
"name": "My Other App",
|
30
|
+
"oauth": null,
|
31
|
+
"owner_account": {
|
32
|
+
"account_id": "dc5deeb9e10b044c591ef2475aafad1d1d3bd888",
|
33
|
+
"email_address": "john@example.com"
|
34
|
+
}
|
35
|
+
}
|
36
|
+
],
|
37
|
+
"list_info": {
|
38
|
+
"num_pages": 1,
|
39
|
+
"num_results": 2,
|
40
|
+
"page": 1,
|
41
|
+
"page_size": 20
|
42
|
+
}
|
43
|
+
}
|