sign_well 0.1.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4c3b4857445a4b5f24e6e354a2e8bf3cc53a404e51990e89d67e6dc73552da26
4
+ data.tar.gz: 46caf33bceb083b6827c8fcd107b32721ac0cc1d40970c21734d2d85ad4688e6
5
+ SHA512:
6
+ metadata.gz: 98c0670b3fce6e8b02be988218c56af532d06459599bc8db2a1d41075ca4838160b2f22fe97213949d7d1520c9943b741c9edfcc5991d412b2e87f201c26d079
7
+ data.tar.gz: 030fe9fe98aa957fac4ef7d5913de6d42d7949bd305be4c105c706f3e4cff92875fe1a64f950c6a2b682d549857987f02a7db7ba9006f5e618c4e3b6fed49309
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-03-01
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at williamkennedyjnr@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in sign_well.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "minitest", "~> 5.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,52 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sign_well (0.1.0)
5
+ faraday (~> 1.7)
6
+ faraday_middleware (~> 1.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ faraday (1.10.0)
12
+ faraday-em_http (~> 1.0)
13
+ faraday-em_synchrony (~> 1.0)
14
+ faraday-excon (~> 1.1)
15
+ faraday-httpclient (~> 1.0)
16
+ faraday-multipart (~> 1.0)
17
+ faraday-net_http (~> 1.0)
18
+ faraday-net_http_persistent (~> 1.0)
19
+ faraday-patron (~> 1.0)
20
+ faraday-rack (~> 1.0)
21
+ faraday-retry (~> 1.0)
22
+ ruby2_keywords (>= 0.0.4)
23
+ faraday-em_http (1.0.0)
24
+ faraday-em_synchrony (1.0.0)
25
+ faraday-excon (1.1.0)
26
+ faraday-httpclient (1.0.1)
27
+ faraday-multipart (1.0.3)
28
+ multipart-post (>= 1.2, < 3)
29
+ faraday-net_http (1.0.1)
30
+ faraday-net_http_persistent (1.2.0)
31
+ faraday-patron (1.0.0)
32
+ faraday-rack (1.0.0)
33
+ faraday-retry (1.0.3)
34
+ faraday_middleware (1.2.0)
35
+ faraday (~> 1.0)
36
+ minitest (5.15.0)
37
+ multipart-post (2.1.1)
38
+ rake (13.0.6)
39
+ ruby2_keywords (0.0.5)
40
+
41
+ PLATFORMS
42
+ x86_64-darwin-20
43
+ x86_64-linux
44
+
45
+ DEPENDENCIES
46
+ bundler (~> 2.3.4)
47
+ minitest (~> 5.0)
48
+ rake (~> 13.0)
49
+ sign_well!
50
+
51
+ BUNDLED WITH
52
+ 2.3.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 William Kennedy
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,187 @@
1
+ # SignWell
2
+
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ ```ruby
8
+ gem 'sign_well'
9
+ ```
10
+
11
+ And then execute:
12
+
13
+ $ bundle install
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install sign_well
18
+
19
+ ## Usage
20
+
21
+ Every request returns a `SignWell::Response` object. You can call `body` or `to_object` on this to get either the json body or a Ruby object.
22
+
23
+
24
+ ### Setup
25
+
26
+ You will `Ruby 2.7` or greater.
27
+
28
+ You will need an `x_api_key` from SignWell to start. After that, you simply initialize the client.
29
+
30
+ ```
31
+ client = SignWell::Client.new(x_api_key: ENV['X_API_KEY'])
32
+
33
+ ```
34
+
35
+ ## [Get Document](https://developers.signwell.com/reference/get_api-v1-documents-id--1)
36
+
37
+ ```
38
+ response = client.document('docment_id')
39
+ response.body => Hash of the JSON.body
40
+ response.to_object => OpenStruct
41
+ ```
42
+
43
+ ## [Create Document](https://developers.signwell.com/reference/post_api-v1-documents-1)
44
+
45
+ ```
46
+ response = client.create_document(test_mode: true, files: [{name: 'test', file_url: 'exmpaledoc.com'}], recipients: [{id: 1, email: 'william@test.com'}])
47
+ response.body => Hash of the JSON.body
48
+ response.to_object => OpenStruct
49
+ ```
50
+
51
+ ## [Create Document from Template](https://developers.signwell.com/reference/post_api-v1-document-templates-documents-1)
52
+
53
+ ```
54
+ response = client.create_document_from_template(test_mode: true, template_id: 'template_id', recipients: [{id: 1, email: 'test@test.com', placeholder_name: 'Customer', name: 'Customer'}, {id: 2, email: 'sender@sent.com',name: 'William', placeholder_name: 'Document Sender'}], template_fields: [{api_id: 'TextField_1', value: 'hello'}, {api_id: 'CheckBox_1', value: true}
55
+ ])
56
+ response.body => Hash of the JSON.body
57
+ response.to_object => OpenStruct
58
+ ```
59
+
60
+ ## [Update and Send Document](https://developers.signwell.com/reference/post_api-v1-documents-id-send-1)
61
+
62
+ ```
63
+ response = client.update_and_send_document(document_id, test_mode: true, embedded_signing: true)
64
+ response.body => Hash of the JSON.body
65
+ response.to_object => OpenStruct
66
+ ```
67
+
68
+ ## [Delete Document](https://developers.signwell.com/reference/delete_api-v1-documents-id--1)
69
+
70
+ ```
71
+ response = client.delete_document(document_id)
72
+ ```
73
+
74
+ ## [Completed PDF](https://developers.signwell.com/reference/get_api-v1-documents-id-completed-pdf-1)
75
+
76
+ ```
77
+ response = client.completed_pdf(document_id, test_mode: true, url_only: true)
78
+ response.body => Hash of the JSON.body
79
+ response.to_object => OpenStruct
80
+ ```
81
+
82
+
83
+ ## [Get Template](https://developers.signwell.com/reference/get_api-v1-document-templates-id--1)
84
+
85
+ ```
86
+ response = client.template(tempate_id)
87
+ response.body => Hash of the JSON.body
88
+ response.to_object => OpenStruct
89
+ ```
90
+
91
+ ## [Create Template](https://developers.signwell.com/reference/post_api-v1-document-templates-1)
92
+
93
+ ```
94
+ body = {test_mode: true, "files"=>[{"name"=>"string.pdf", "file_url"=>"https://file-examples-com.github.io/uploads/2017/10/file-sample_150kB.pdf"}],
95
+ "placeholders"=>[{"id"=>"string", "name"=>"string"}],
96
+ "draft"=>false,
97
+ "reminders"=>true,
98
+ "apply_signing_order"=>false,
99
+ "text_tags"=>false,
100
+ "allow_decline"=>true,
101
+ "fields"=>[[{"required"=>true, "fixed_width"=>false, "lock_sign_date"=>false, "date_format"=>"MM/DD/YYYY", "x"=>0, "y"=>0, "page"=>0, "placeholder_id"=>"string", "type"=>"date", "api_id"=>"string"}]],
102
+ "attachment_requests"=>[{"required"=>true, "name"=>"string", "placeholder_id"=>"string"}],
103
+ "name"=>"string",
104
+ "subject"=>"string",
105
+ "message"=>"string",
106
+ "expires_in"=>0}
107
+
108
+ response = client.create_template(body)
109
+ response.body => Hash of the JSON.body
110
+ response.to_object => OpenStruct
111
+ ```
112
+
113
+ ## [Delete Template](https://developers.signwell.com/reference/delete_api-v1-document-templates-id--1)
114
+
115
+ ```
116
+ client.delete_template(id)
117
+ ```
118
+
119
+ ## [Get API Application](https://developers.signwell.com/reference/get_api-v1-api-applications-id--1)
120
+
121
+ ```
122
+ response = client.api_application(id)
123
+ response.body => Hash of the JSON.body
124
+ response.to_object => OpenStruct
125
+ ```
126
+
127
+ ## [Delete API Application](https://developers.signwell.com/reference/delete_api-v1-api-applications-id--1)
128
+
129
+ ```
130
+ client.delete_api_application(id)
131
+ ```
132
+
133
+ ## [List Webhooks](https://developers.signwell.com/reference/get_api-v1-hooks-1)
134
+
135
+ ```
136
+ response = client.list_web_hooks
137
+ response.body => Hash of the JSON.body
138
+ response.to_object => OpenStruct
139
+ ```
140
+
141
+ ## [Create Webhooks](https://developers.signwell.com/reference/post_api-v1-hooks-1)
142
+
143
+ ```
144
+ response = client.create_web_hook(test_mode: true, callback_url: 'https://test.com')
145
+ response.body => Hash of the JSON.body
146
+ response.to_object => OpenStruct
147
+ ```
148
+
149
+ ## [Delete Webhook](https://developers.signwell.com/reference/delete_api-v1-hooks-id--1)
150
+
151
+ ```
152
+ client.delete_web_hook(id)
153
+ ```
154
+
155
+ ## [Get Credentials](https://developers.signwell.com/reference/get_api-v1-me-1)
156
+
157
+ ```
158
+ client.me
159
+ ```
160
+
161
+
162
+ ## Other requests
163
+
164
+ If you can't find the method you're looking, you can call HTTP methods on the `client.connection` which is a Faraday object
165
+
166
+ ```
167
+ client.connection.get(path)
168
+ ```
169
+
170
+
171
+ ## Development
172
+
173
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
174
+
175
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
176
+
177
+ ## Contributing
178
+
179
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/sign_well. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/sign_well/blob/main/CODE_OF_CONDUCT.md).
180
+
181
+ ## License
182
+
183
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
184
+
185
+ ## Code of Conduct
186
+
187
+ Everyone interacting in the SignWell project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/sign_well/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/test_*.rb", "test/**/*_test.rb"]
10
+ end
11
+
12
+ task default: :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "sign_well"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,81 @@
1
+ module SignWell
2
+ class Client
3
+ attr_reader :x_api_key, :stubs
4
+ BASE_URL = 'https://www.signwell.com/api/v1'
5
+
6
+ def initialize(x_api_key:, stubs: nil)
7
+ @x_api_key = x_api_key
8
+ @stubs = stubs
9
+ end
10
+
11
+ def document(id, params = {})
12
+ DocumentResource.new(self).get(id, params)
13
+ end
14
+
15
+ def create_document(params)
16
+ DocumentResource.new(self).create(params)
17
+ end
18
+
19
+ def create_document_from_template(params)
20
+ DocumentResource.new(self).create_from_template(params)
21
+ end
22
+
23
+ def update_and_send_document(id, params)
24
+ DocumentResource.new(self).update_and_send_document(id, params)
25
+ end
26
+
27
+ def delete_document(id)
28
+ DocumentResource.new(self).delete(id)
29
+ end
30
+
31
+ def completed_pdf(id, params)
32
+ DocumentResource.new(self).completed_pdf(id, params)
33
+ end
34
+
35
+ def template(id, params = {})
36
+ TemplateResource.new(self).get(id, params)
37
+ end
38
+
39
+ def create_template(params)
40
+ TemplateResource.new(self).create(params)
41
+ end
42
+
43
+ def delete_template(id)
44
+ TemplateResource.new(self).delete(id)
45
+ end
46
+
47
+ def api_application(id, params = {})
48
+ ApiApplicationResource.new(self).get(id, params)
49
+ end
50
+
51
+ def delete_api_application(id)
52
+ ApiApplicationResource.new(self).delete(id)
53
+ end
54
+
55
+ def list_web_hooks
56
+ WebHookResource.new(self).list
57
+ end
58
+
59
+ def create_web_hook(params)
60
+ WebHookResource.new(self).create(params)
61
+ end
62
+
63
+ def delete_web_hook(id)
64
+ WebHookResource.new(self).delete(id)
65
+ end
66
+
67
+ def me
68
+ MeResource.new(self).get
69
+ end
70
+
71
+ def connection
72
+ @connection ||= Faraday.new(url: BASE_URL) do |conn|
73
+ conn.headers['X-Api-Key'] = x_api_key
74
+ conn.response :json, content_type: 'application/json'
75
+ if @stubs
76
+ conn.adapter :test, @stubs
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,35 @@
1
+ module SignWell
2
+ class Resource
3
+ attr_reader :client
4
+
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+
10
+ private
11
+
12
+ def get_request(path, params)
13
+ client.connection.get(path, params)
14
+ end
15
+
16
+ def post_request(path, params)
17
+ client.connection.post(path) do |req|
18
+ req.params = params
19
+ req.headers['Content-Type'] = 'application/json'
20
+ end
21
+ end
22
+
23
+ def patch_request(path, params)
24
+ client.connection.patch(path) do |req|
25
+ req.params = params
26
+ req.headers['Content-Type'] = 'application/json'
27
+ req.headers['Accept'] = 'application/json'
28
+ end
29
+ end
30
+
31
+ def delete_request(path)
32
+ client.connection.delete(path)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,11 @@
1
+ module SignWell
2
+ class ApiApplicationResource < Resource
3
+ def get(id, params)
4
+ Response.new(get_request("api_applications/#{id}", params).body)
5
+ end
6
+
7
+ def delete(id)
8
+ Response.new(delete_request("api_applications/#{id}"))
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,27 @@
1
+ module SignWell
2
+ class DocumentResource < Resource
3
+ def get(id, params)
4
+ Response.new(get_request("documents/#{id}",params).body)
5
+ end
6
+
7
+ def create(params)
8
+ Response.new(post_request("documents", params).body)
9
+ end
10
+
11
+ def create_from_template(params)
12
+ Response.new(post_request("document_templates/documents", params).body)
13
+ end
14
+
15
+ def update_and_send_document(id, params)
16
+ Response.new(post_request("documents/#{id}/send", params).body)
17
+ end
18
+
19
+ def delete(id)
20
+ Response.new(delete_request("documents/#{id}"))
21
+ end
22
+
23
+ def completed_pdf(id, params)
24
+ Response.new(get_request("documents/#{id}/completed_pdf", params).body)
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,7 @@
1
+ module SignWell
2
+ class MeResource < Resource
3
+ def get
4
+ Response.new(get_request('me', {}).body)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,20 @@
1
+ module SignWell
2
+ class TemplateResource < Resource
3
+ def get(id, params)
4
+ Response.new(get_request("document_templates/#{id}", params).body)
5
+ end
6
+
7
+ def create(params)
8
+ # odd array nesting issue with the API so opting to use client.connection instead
9
+ response = client.connection.post('document_templates') do |req|
10
+ req.headers['Content-Type'] = 'application/json'
11
+ req.body = params.to_json
12
+ end
13
+ Response.new(response.body)
14
+ end
15
+
16
+ def delete(id)
17
+ Response.new(delete_request("document_templates/#{id}"))
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,15 @@
1
+ module SignWell
2
+ class WebHookResource < Resource
3
+ def list(params={})
4
+ Response.new(get_request("hooks", params).body)
5
+ end
6
+
7
+ def create(params)
8
+ Response.new(post_request("hooks", params).body)
9
+ end
10
+
11
+ def delete(id)
12
+ Response.new(delete_request("hooks/#{id}"))
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,28 @@
1
+ require "ostruct"
2
+
3
+ module SignWell
4
+ class SignWell::Response
5
+ attr_reader :body
6
+
7
+ def initialize(body)
8
+ @body = body
9
+ end
10
+
11
+ def to_object
12
+ to_ostruct(body)
13
+ end
14
+
15
+ private
16
+
17
+ def to_ostruct(body)
18
+ if body.is_a?(Hash)
19
+ OpenStruct.new(body.map { |key, val| [key, to_ostruct(val)] }.to_h)
20
+ elsif body.is_a?(Array)
21
+ body.map { |o| to_ostruct(o) }
22
+ else
23
+ body
24
+ end
25
+ end
26
+ end
27
+ end
28
+
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SignWell
4
+ VERSION = "0.1.0"
5
+ end
data/lib/sign_well.rb ADDED
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "sign_well/version"
4
+ require "faraday"
5
+ require "faraday_middleware"
6
+
7
+ module SignWell
8
+ autoload :Client, "sign_well/client"
9
+ autoload :Resource, "sign_well/resource"
10
+
11
+ #Endpoints
12
+
13
+ autoload :DocumentResource, "sign_well/resources/document_resource"
14
+ autoload :TemplateResource, "sign_well/resources/template_resource"
15
+ autoload :ApiApplicationResource, "sign_well/resources/api_application_resource"
16
+ autoload :WebHookResource, "sign_well/resources/web_hook_resource"
17
+ autoload :MeResource, "sign_well/resources/me_resource"
18
+
19
+ # Responder
20
+ autoload :Response, "sign_well/response"
21
+
22
+ end
data/sig/sign_well.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module SignWell
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,133 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sign_well
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - William Kennedy
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-03-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.3.4
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.3.4
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '13.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '13.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: faraday
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.7'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: faraday_middleware
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.1'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.1'
83
+ description: ''
84
+ email:
85
+ - william.kennedy@hey.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - CHANGELOG.md
91
+ - CODE_OF_CONDUCT.md
92
+ - Gemfile
93
+ - Gemfile.lock
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - bin/console
98
+ - bin/setup
99
+ - lib/sign_well.rb
100
+ - lib/sign_well/client.rb
101
+ - lib/sign_well/resource.rb
102
+ - lib/sign_well/resources/api_application_resource.rb
103
+ - lib/sign_well/resources/document_resource.rb
104
+ - lib/sign_well/resources/me_resource.rb
105
+ - lib/sign_well/resources/template_resource.rb
106
+ - lib/sign_well/resources/web_hook_resource.rb
107
+ - lib/sign_well/response.rb
108
+ - lib/sign_well/version.rb
109
+ - sig/sign_well.rbs
110
+ homepage: https://github.com/williamkennedy/sign_well
111
+ licenses:
112
+ - MIT
113
+ metadata: {}
114
+ post_install_message:
115
+ rdoc_options: []
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: 2.7.0
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ requirements: []
129
+ rubygems_version: 3.2.15
130
+ signing_key:
131
+ specification_version: 4
132
+ summary: An API wrapper around the SignWell API
133
+ test_files: []