ltfi-wsap 2.0.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 (6) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +37 -0
  3. data/README.md +76 -0
  4. data/lib/ltfi_wsap/client.rb +136 -0
  5. data/lib/ltfi_wsap.rb +27 -0
  6. metadata +149 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 536cc508c0e7e2a1484888424a584e6f5a931e03e9574946db818d9e198b985a
4
+ data.tar.gz: 7cc640ef494612844d4a8a65e755c67709a8209a8b7cfcd571e133898f2f0e60
5
+ SHA512:
6
+ metadata.gz: 3a13497eeff01e27c55bdb022c482551a634c7fbb437b7f8f7ad7768dc314090a5acdad05cc11af32cf0652a2e4b29e72d96c2669ab161bf1ec8f55afeff8687
7
+ data.tar.gz: 8e37dc7fa548ff3a4d93998ed821c43f58876af4ea6375d5117a9cc9a50bb99e4caa866d5c0a83e3b9b768fdb89ad5ae68cd2c7540e66f7221cc4f9ae12413d4
data/LICENSE ADDED
@@ -0,0 +1,37 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Kief Studio, MA
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
+ --------------------------------------------------------------------------------
24
+
25
+ LTFI-WSAP SERVICE USAGE NOTICE:
26
+
27
+ This SDK is open source and free to use. However, usage of the LTFI-WSAP
28
+ service itself is subject to the LTFI-WSAP Terms of Service:
29
+
30
+ - FREE for most users and use cases
31
+ - FREE for personal use, open source projects, and small businesses
32
+ - Paid plans required for:
33
+ - Enterprises with annual revenue exceeding $1M USD
34
+ - Organizations managing more than 100 domains
35
+ - High-volume API usage (see pricing at https://wsap.ltfi.ai/pricing)
36
+
37
+ For details, visit https://wsap.ltfi.ai/terms
data/README.md ADDED
@@ -0,0 +1,76 @@
1
+ <div align="center">
2
+ <img src="https://github.com/KiefStudioMA/LTFI-WSAP/raw/main/assets/KS-FullLogo-DarkGrey-300dpi.png#gh-light-mode-only" alt="Kief Studio" height="80">
3
+ <img src="https://github.com/KiefStudioMA/LTFI-WSAP/raw/main/assets/KS-FullLogo-LightSilver-300dpi.png#gh-dark-mode-only" alt="Kief Studio" height="80">
4
+ &nbsp;&nbsp;&nbsp;&nbsp;
5
+ <img src="https://github.com/KiefStudioMA/LTFI-WSAP/raw/main/assets/LTFI-Logo.png#gh-light-mode-only" alt="LTFI" height="80">
6
+ <img src="https://github.com/KiefStudioMA/LTFI-WSAP/raw/main/assets/LTFI-Logo-White.png#gh-dark-mode-only" alt="LTFI" height="80">
7
+ </div>
8
+
9
+ # LTFI-WSAP Ruby SDK
10
+
11
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/KiefStudioMA/ltfi-wsap-ruby/blob/main/LICENSE)
12
+ [![LTFI-WSAP](https://img.shields.io/badge/LTFI--WSAP-v2.0.0-blue.svg)](https://wsap.ltfi.ai)
13
+ [![Kief Studio](https://img.shields.io/badge/By-Kief%20Studio-green.svg)](https://kief.studio)
14
+
15
+ Official Ruby SDK for **LTFI-WSAP** (Layered Transformer Framework Intelligence - Web System Alignment Protocol) by **Kief Studio**.
16
+
17
+ Part of the [LTFI Ecosystem](https://ltfi.ai) • [WSAP Protocol](https://wsap.ltfi.ai)
18
+
19
+ ## 📦 Installation
20
+
21
+ See the [main repository](https://github.com/KiefStudioMA/LTFI-WSAP) for installation instructions.
22
+
23
+ ## 📚 Documentation
24
+
25
+ - **Main Documentation**: [docs.ltfi.ai](https://docs.ltfi.ai)
26
+ - **API Reference**: [api.ltfi.ai/docs](https://api.ltfi.ai/docs)
27
+ - **Examples**: [github.com/KiefStudioMA/LTFI-WSAP-Examples](https://github.com/KiefStudioMA/LTFI-WSAP-Examples)
28
+
29
+ ## 🔑 Quick Start
30
+
31
+ ```bash
32
+ # Get your API key from https://wsap.ltfi.ai
33
+ export LTFI_WSAP_API_KEY="your-api-key"
34
+ ```
35
+
36
+ ## 📄 License
37
+
38
+ **MIT License** - This SDK is open source and free to use.
39
+
40
+ See [LICENSE](LICENSE) for full terms.
41
+
42
+ ### LTFI-WSAP Service Usage
43
+
44
+ While this SDK is open source, the LTFI-WSAP service has the following usage terms:
45
+
46
+ - ✅ **FREE** for personal use, open source projects, and small businesses
47
+ - ✅ **FREE** for most users and use cases
48
+ - 💳 **Paid plans** required for:
49
+ - Enterprises with annual revenue exceeding $1M USD
50
+ - Organizations managing more than 100 domains
51
+ - High-volume API usage
52
+
53
+ For pricing details: [wsap.ltfi.ai/pricing](https://wsap.ltfi.ai/pricing)
54
+
55
+ - **Technical Support**: developers@kief.studio
56
+ - **Business Inquiries**: business@kief.studio
57
+ - **Discord**: [discord.gg/JfjyUdjJgP](https://discord.gg/JfjyUdjJgP)
58
+ - **X (Twitter)**: [x.com/kief_ma](https://x.com/kief_ma)
59
+ - **LinkedIn**: [linkedin.com/company/kief-studio](https://www.linkedin.com/company/kief-studio/)
60
+
61
+ ---
62
+
63
+ <div align="center">
64
+ <br>
65
+ <img src="https://github.com/KiefStudioMA/LTFI-WSAP/raw/main/assets/KS-icon-black-1024.png#gh-light-mode-only" alt="Kief Studio" width="64">
66
+ <img src="https://github.com/KiefStudioMA/LTFI-WSAP/raw/main/assets/KS-icon-white-1024.png#gh-dark-mode-only" alt="Kief Studio" width="64">
67
+ <br><br>
68
+
69
+ **Built with ❤️ by [Kief Studio](https://kief.studio)**
70
+
71
+ Part of the [LTFI Ecosystem](https://ltfi.ai) • [WSAP Protocol](https://wsap.ltfi.ai)
72
+
73
+ © 2025 Kief Studio, MA. All rights reserved.
74
+
75
+ **Open Source SDK - Service usage subject to terms**
76
+ </div>
@@ -0,0 +1,136 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LTFI
4
+ module WSAP
5
+ class Client
6
+ attr_reader :api_key, :base_url, :timeout
7
+
8
+ def initialize(api_key: nil, base_url: nil, timeout: nil)
9
+ @api_key = api_key || ENV["LTFI_WSAP_API_KEY"] || LTFI::WSAP.configuration&.api_key
10
+ @base_url = base_url || LTFI::WSAP.configuration&.base_url || "https://api.ltfi.ai"
11
+ @timeout = timeout || LTFI::WSAP.configuration&.timeout || 30
12
+
13
+ raise AuthenticationError, "API key required: set LTFI_WSAP_API_KEY or provide in config" if @api_key.nil? || @api_key.empty?
14
+ end
15
+
16
+ # List entities with optional filters
17
+ def list_entities(params = {})
18
+ response = connection.get("/api/entities/", params)
19
+ handle_response(response)
20
+ end
21
+
22
+ # Get a specific entity
23
+ def get_entity(id)
24
+ response = connection.get("/api/entities/#{id}/")
25
+ handle_response(response)
26
+ end
27
+
28
+ # Create a new entity
29
+ def create_entity(data)
30
+ response = connection.post("/api/entities/") do |req|
31
+ req.headers["Content-Type"] = "application/json"
32
+ req.body = data.to_json
33
+ end
34
+ handle_response(response)
35
+ end
36
+
37
+ # Update an entity
38
+ def update_entity(id, data)
39
+ response = connection.put("/api/entities/#{id}/") do |req|
40
+ req.headers["Content-Type"] = "application/json"
41
+ req.body = data.to_json
42
+ end
43
+ handle_response(response)
44
+ end
45
+
46
+ # Delete an entity
47
+ def delete_entity(id)
48
+ response = connection.delete("/api/entities/#{id}/")
49
+ handle_response(response)
50
+ end
51
+
52
+ # Initiate domain verification
53
+ def initiate_verification(domain, method = "dns_txt")
54
+ response = connection.post("/api/verification/initiate/") do |req|
55
+ req.headers["Content-Type"] = "application/json"
56
+ req.body = { domain: domain, method: method }.to_json
57
+ end
58
+ handle_response(response)
59
+ end
60
+
61
+ # Check domain verification status
62
+ def verify_domain(domain)
63
+ response = connection.post("/api/verification/verify/") do |req|
64
+ req.headers["Content-Type"] = "application/json"
65
+ req.body = { domain: domain }.to_json
66
+ end
67
+
68
+ if response.success?
69
+ data = JSON.parse(response.body)
70
+ data["verified"]
71
+ else
72
+ false
73
+ end
74
+ end
75
+
76
+ # Generate WSAP data
77
+ def generate_wsap(entity_id, disclosure_level = "STANDARD")
78
+ response = connection.post("/api/wsap/generate/") do |req|
79
+ req.headers["Content-Type"] = "application/json"
80
+ req.body = {
81
+ entity_id: entity_id,
82
+ disclosure_level: disclosure_level.upcase
83
+ }.to_json
84
+ end
85
+ handle_response(response)
86
+ end
87
+
88
+ # Fetch public WSAP data
89
+ def fetch_wsap(domain)
90
+ response = connection.get("/api/wsap/public/#{domain}/")
91
+ handle_response(response)
92
+ end
93
+
94
+ # Get current user
95
+ def get_current_user
96
+ response = connection.get("/api/auth/me/")
97
+ handle_response(response)
98
+ end
99
+
100
+ # Health check
101
+ def health_check
102
+ response = connection.get("/api/health/")
103
+ handle_response(response)
104
+ end
105
+
106
+ private
107
+
108
+ def connection
109
+ @connection ||= Faraday.new(url: base_url) do |faraday|
110
+ faraday.request :authorization, "Bearer", api_key
111
+ faraday.request :retry, max: 3, interval: 0.5
112
+ faraday.adapter Faraday.default_adapter
113
+ faraday.headers["User-Agent"] = "LTFI-WSAP-Ruby/2.0.0"
114
+ faraday.options.timeout = timeout
115
+ end
116
+ end
117
+
118
+ def handle_response(response)
119
+ case response.status
120
+ when 200..299
121
+ JSON.parse(response.body) if response.body && !response.body.empty?
122
+ when 401
123
+ raise AuthenticationError, "Authentication failed: #{response.body}"
124
+ when 404
125
+ raise NotFoundError, "Resource not found: #{response.body}"
126
+ when 400..499
127
+ raise ClientError, "Client error (#{response.status}): #{response.body}"
128
+ when 500..599
129
+ raise ServerError, "Server error (#{response.status}): #{response.body}"
130
+ else
131
+ raise APIError, "Unexpected error (#{response.status}): #{response.body}"
132
+ end
133
+ end
134
+ end
135
+ end
136
+ end
data/lib/ltfi_wsap.rb ADDED
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "faraday"
4
+ require "faraday/retry"
5
+ require "json"
6
+
7
+ require_relative "ltfi_wsap/version"
8
+ require_relative "ltfi_wsap/configuration"
9
+ require_relative "ltfi_wsap/client"
10
+ require_relative "ltfi_wsap/errors"
11
+ require_relative "ltfi_wsap/models/entity"
12
+ require_relative "ltfi_wsap/models/verification"
13
+ require_relative "ltfi_wsap/models/wsap_data"
14
+ require_relative "ltfi_wsap/models/user"
15
+
16
+ module LTFI
17
+ module WSAP
18
+ class << self
19
+ attr_accessor :configuration
20
+
21
+ def configure
22
+ self.configuration ||= Configuration.new
23
+ yield(configuration) if block_given?
24
+ end
25
+ end
26
+ end
27
+ end
metadata ADDED
@@ -0,0 +1,149 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ltfi-wsap
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Kief Studio
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2025-09-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday-retry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.6'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.12'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.12'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.19'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.19'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '13.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '13.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.56'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.56'
111
+ description: Official Ruby SDK for LTFI-WSAP (Layered Transformer Framework Intelligence
112
+ - Web System Alignment Protocol) API
113
+ email:
114
+ - developers@kief.studio
115
+ executables: []
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - LICENSE
120
+ - README.md
121
+ - lib/ltfi_wsap.rb
122
+ - lib/ltfi_wsap/client.rb
123
+ homepage: https://github.com/KiefStudioMA/LTFI-WSAP-Ruby
124
+ licenses:
125
+ - MIT
126
+ metadata:
127
+ homepage_uri: https://github.com/KiefStudioMA/LTFI-WSAP-Ruby
128
+ source_code_uri: https://github.com/KiefStudioMA/LTFI-WSAP-Ruby
129
+ changelog_uri: https://github.com/KiefStudioMA/LTFI-WSAP-Ruby/blob/main/CHANGELOG.md
130
+ post_install_message:
131
+ rdoc_options: []
132
+ require_paths:
133
+ - lib
134
+ required_ruby_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 2.7.0
139
+ required_rubygems_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ requirements: []
145
+ rubygems_version: 3.3.15
146
+ signing_key:
147
+ specification_version: 4
148
+ summary: LTFI-WSAP Ruby SDK
149
+ test_files: []