instafill 0.3.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.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +53 -0
  4. data/instafill.rb +109 -0
  5. metadata +78 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1fb0b238a113376fbcab28bb7dd6e3580e3c709baa00b067bf8144197331d092
4
+ data.tar.gz: 2f13a8c4ff5af40a75f8588453a7b57d4fcc3b6d999bd99ca3728adcf7524b98
5
+ SHA512:
6
+ metadata.gz: b754654c863016263bb018e3be7707b5f77b1fae058cbfc37d06c519212ab02b9efbd728b686180e7c9501d638bec32feaa9e0301f54fc570813aa777efdf794
7
+ data.tar.gz: 7db458566f8b9c26daf7342121d722903e95a672924dfccd7828194a1ff6a808e559b0bc424cef32667e016b31ebc9c48bd714db0c57ac729220b651ea69e613
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 instafill.ai
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,53 @@
1
+ # Instafill Ruby Library
2
+
3
+ ## Introduction
4
+ Instafill is an innovative platform designed to automate the filling of PDF forms using advanced AI technologies. This Ruby library allows developers to seamlessly integrate Instafill AI's capabilities into their applications, optimizing form processing workflows.
5
+
6
+ ## Features
7
+ - **Automated Form Filling**: Utilize Instafill AI's AI-driven form filling capabilities to efficiently process PDF forms.
8
+ - **Batch Processing**: Manage multiple forms concurrently for large-scale applications.
9
+ - **Digital Signatures**: Incorporate digital signatures into completed forms, enhancing workflow efficiency.
10
+
11
+ ## Prerequisites
12
+ Before using this library, ensure you have:
13
+ - Ruby 2.5 or later installed.
14
+ - An Instafill AI account with API credentials. To obtain an API key, contact us at [api@instafill.ai](mailto:api@instafill.ai).
15
+
16
+ ## Installation
17
+ To install the library, add this line to your application's Gemfile:
18
+ ```ruby
19
+ gem 'instafill'
20
+ ```
21
+ And then execute:
22
+ ```bash
23
+ bundle install
24
+ ```
25
+ Or install it directly using:
26
+ ```bash
27
+ gem install instafill
28
+ ```
29
+
30
+ ## Usage
31
+ ```ruby
32
+ require 'instafill'
33
+
34
+ client = Instafill::Client.new('your_api_key_here')
35
+
36
+ def run_examples
37
+ begin
38
+ form_id = 'w-9-2024'
39
+ get_form_response = client.get_form(form_id)
40
+ puts "Get Form Response: #{get_form_response}"
41
+ rescue => error
42
+ puts "Error: #{error.respond_to?(:response) ? error.response.data : error.message}"
43
+ end
44
+ end
45
+
46
+ run_examples
47
+ ```
48
+
49
+ ## Home Page
50
+ Visit our [home page](https://instafill.ai) to discover more about Instafill and its capabilities.
51
+
52
+ ## ChatGPT Integration
53
+ You can also use Instafill directly within ChatGPT to fill PDF forms effortlessly. Try it out here: [Fill PDF Forms with ChatGPT](https://chat.openai.com/g/g-WFalxIZ4n-fill-pdf-forms).
data/instafill.rb ADDED
@@ -0,0 +1,109 @@
1
+ require 'net/http'
2
+ require 'json'
3
+ require 'uri'
4
+ require 'dotenv'
5
+
6
+ Dotenv.load
7
+
8
+ class InstaFillClient
9
+ BASE_URL = 'https://api.instafill.ai/v1/forms'
10
+ SESSION_URL = 'https://api.instafill.ai/v1/session'
11
+ PROFILE_URL = 'https://api.instafill.ai/api/profile'
12
+
13
+ def initialize(api_key = nil)
14
+ @api_key = api_key || ENV['INSTAFILL_API_KEY']
15
+ raise 'API key must be provided either as a parameter or in the .env file' unless @api_key
16
+ end
17
+
18
+ def create_form(data, content_type = 'application/json')
19
+ headers = { 'Content-Type' => content_type, 'x-api-key' => @api_key }
20
+ send_request(BASE_URL, 'Post', data, headers)
21
+ end
22
+
23
+ def get_form(form_id)
24
+ send_request("#{BASE_URL}/#{form_id}", 'Get', nil, { 'x-api-key' => @api_key })
25
+ end
26
+
27
+ def list_forms
28
+ send_request(BASE_URL, 'Get', nil, { 'x-api-key' => @api_key })
29
+ end
30
+
31
+ def update_form(form_id, data)
32
+ send_request("#{BASE_URL}/#{form_id}", 'Put', data, { 'x-api-key' => @api_key })
33
+ end
34
+
35
+ def create_session(data)
36
+ headers = { 'Content-Type' => 'application/json', 'x-api-key' => @api_key }
37
+ send_request(SESSION_URL, 'Post', data, headers)
38
+ end
39
+
40
+ def get_session(session_id)
41
+ send_request("#{SESSION_URL}/#{session_id}", 'Get', nil, { 'x-api-key' => @api_key })
42
+ end
43
+
44
+ def get_profiles(name: '', page: 1, size: 10, status: '')
45
+ params = { name: name, page: page, size: size, status: status }
46
+ uri = URI(PROFILE_URL)
47
+ uri.query = URI.encode_www_form(params)
48
+ send_request(uri.to_s, 'Get', nil, { 'x-api-key' => @api_key })
49
+ end
50
+
51
+ def create_profile
52
+ send_request("#{PROFILE_URL}/new", 'Get', nil, { 'x-api-key' => @api_key })
53
+ end
54
+
55
+ def get_profile(profile_id)
56
+ send_request("#{PROFILE_URL}/#{profile_id}", 'Get', nil, { 'x-api-key' => @api_key })
57
+ end
58
+
59
+ def delete_profile(profile_id)
60
+ send_request("#{PROFILE_URL}/#{profile_id}", 'Delete', nil, { 'x-api-key' => @api_key })
61
+ end
62
+
63
+ def update_profile_name(profile_id, name)
64
+ data = { name: name }
65
+ send_request("#{PROFILE_URL}/#{profile_id}/name", 'Put', data, { 'x-api-key' => @api_key })
66
+ end
67
+
68
+ def upload_files(profile_id, files)
69
+ uri = URI("#{PROFILE_URL}/#{profile_id}/files")
70
+ request = Net::HTTP::Put.new(uri, { 'x-api-key' => @api_key })
71
+ form_data = []
72
+ files.each { |file| form_data << ['files', file] }
73
+ request.set_form form_data, 'multipart/form-data'
74
+ execute_request(uri, request)
75
+ end
76
+
77
+ def delete_files(profile_id, file_ids)
78
+ data = { ids: file_ids }
79
+ send_request("#{PROFILE_URL}/#{profile_id}/files", 'Delete', data, { 'x-api-key' => @api_key })
80
+ end
81
+
82
+ def update_profile_text_info(profile_id, text_info)
83
+ data = { text_info: text_info }
84
+ send_request("#{PROFILE_URL}/#{profile_id}/text", 'Put', data, { 'x-api-key' => @api_key })
85
+ end
86
+
87
+ private
88
+
89
+ def send_request(url, method, data = nil, headers = {})
90
+ uri = URI(url)
91
+ request = case method
92
+ when 'Get' then Net::HTTP::Get.new(uri, headers)
93
+ when 'Post' then Net::HTTP::Post.new(uri, headers)
94
+ when 'Put' then Net::HTTP::Put.new(uri, headers)
95
+ when 'Delete' then Net::HTTP::Delete.new(uri, headers)
96
+ end
97
+ request.body = data.to_json if data
98
+ execute_request(uri, request)
99
+ end
100
+
101
+ def execute_request(uri, request)
102
+ http = Net::HTTP.new(uri.host, uri.port)
103
+ http.use_ssl = true
104
+ response = http.request(request)
105
+ JSON.parse(response.body) if response.body
106
+ rescue StandardError => e
107
+ { error: e.message }
108
+ end
109
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: instafill
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - instafill.ai
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2025-03-12 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: json
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: net-http
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ description: Instafill is a robust platform that streamlines the process of filling
41
+ and processing PDF forms through cutting-edge AI technologies. This Ruby library
42
+ provides developers with a straightforward interface to integrate Instafill AI's
43
+ services, featuring automated form filling, batch processing capabilities, and digital
44
+ signature integration to enhance workflow efficiency.
45
+ email:
46
+ - api@instafill.ai
47
+ executables: []
48
+ extensions: []
49
+ extra_rdoc_files: []
50
+ files:
51
+ - LICENSE.txt
52
+ - README.md
53
+ - instafill.rb
54
+ homepage: https://instafill.ai
55
+ licenses:
56
+ - MIT
57
+ metadata:
58
+ homepage_uri: https://instafill.ai
59
+ api_uri: https://doc.instafill.ai
60
+ allowed_push_host: https://rubygems.org
61
+ rdoc_options: []
62
+ require_paths:
63
+ - "."
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubygems_version: 3.6.5
76
+ specification_version: 4
77
+ summary: 'Instafill Ruby Library: Automate PDF form filling with advanced AI technology.'
78
+ test_files: []