youspot 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: fd49e47802c4f96a2684403bf62fccb965f6e0d9c6dda693a44a73fc6bd905ce
4
+ data.tar.gz: 9b6ea5d2351ff2837b0637b7038c8e03593380682f4daaddb21a87199d7aef9f
5
+ SHA512:
6
+ metadata.gz: 4ceb88a88554b4699b23b2b027c7601ea3740cdaa7e788b9de46363bd3bdadf337c0253f0234a445b7871b263fb8a33c7903f4032c113471af2cdc92ae51d378
7
+ data.tar.gz: 56f4f1938b91dbeef4572448c7ebb853f66ec0c0c9627131e82e40e5806a5cd26bda6f644042e516dff9d7c1304267849d422d129fce997ea02f01e9370c85dc
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ - First release: ask, docs, markdown, tools, call_tool, the sandbox, member, directory, batch and identity, matching the youspot npm and PyPI packages.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 YouSpot, Inc.
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.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # youspot
2
+
3
+ The official Ruby client for [YouSpot](https://youspot.com), the AI-native personal CRM. Standard library only, Ruby 2.7 or newer.
4
+
5
+ ```bash
6
+ gem install youspot
7
+ ```
8
+
9
+ Everything except `call_tool` works with no credential. Every YouSpot tool reads one person's own contacts, companies, notes and files, so a token always belongs to a person: mint one at [youspot.com/user/mcp](https://youspot.com/user/mcp) and set `YOUSPOT_TOKEN`, or follow the OAuth 2.1 flow in [auth.md](https://youspot.com/auth.md).
10
+
11
+ ```ruby
12
+ require "youspot"
13
+
14
+ client = YouSpot::Client.new
15
+
16
+ answer = client.ask("how do I connect an MCP client", limit: 3)
17
+ answer["results"].each { |hit| puts "#{hit["name"]}: #{hit["url"]}" }
18
+
19
+ client.tools # every tool on the product server
20
+ client.call_sandbox_tool("search_graph_objects", { query: "Meridian" }) # the demo account, no credential
21
+ client.call_tool("get_connections_summary") # needs YOUSPOT_TOKEN
22
+ client.batch([{ id: "dir", path: "/api/network/members", query: { q: "consulting" } }])
23
+ ```
24
+
25
+ | Method | What it does | Credential |
26
+ | -------------------------------------- | ------------------------------------------------------ | --------------- |
27
+ | `index` | Every endpoint, and what each one costs in credentials | none |
28
+ | `ask` | A question about YouSpot, answered from its own pages | none |
29
+ | `search_docs`, `read_doc`, `list_docs` | The developer docs over the documentation MCP server | none |
30
+ | `read_markdown` | Any public page as markdown | none |
31
+ | `tools` | The tools on the product MCP server | none |
32
+ | `call_tool` | One tool, as the member whose token the client holds | `YOUSPOT_TOKEN` |
33
+ | `sandbox_tools`, `call_sandbox_tool` | The read tools over a demo account | none |
34
+ | `member`, `directory` | Public profiles and the public directory | none |
35
+ | `batch` | Up to 20 reads in one round trip | none |
36
+ | `identity` | What identity the caller can hold here | optional |
37
+
38
+ Every failure raises `YouSpot::Error` carrying `status`, the stable `code` and the `url`. `YOUSPOT_BASE_URL` overrides the origin.
39
+
40
+ The machine descriptions this client follows: [openapi.json](https://youspot.com/openapi.json), [the MCP server card](https://youspot.com/.well-known/mcp/server-card.json), [agents.md](https://youspot.com/agents.md) and [llms.txt](https://youspot.com/llms.txt). Developer docs: <https://youspot.com/docs>.
41
+
42
+ MIT licensed. Support: support@youspot.com.
@@ -0,0 +1,146 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require "net/http"
5
+ require "uri"
6
+
7
+ module YouSpot
8
+ class Client
9
+ DEFAULT_BASE_URL = "https://youspot.com"
10
+
11
+ attr_reader :base_url, :token
12
+
13
+ def initialize(base_url: nil, token: nil)
14
+ @base_url = (base_url || ENV["YOUSPOT_BASE_URL"] || DEFAULT_BASE_URL).sub(%r{/+\z}, "")
15
+ @token = token || ENV["YOUSPOT_TOKEN"]
16
+ end
17
+
18
+ def index
19
+ get("/v1")
20
+ end
21
+
22
+ def ask(query, limit: 5)
23
+ get("/ask", query: { query: query, limit: limit })
24
+ end
25
+
26
+ def search_docs(query, limit: 5)
27
+ rpc("/mcp/docs", "tools/call", { name: "search_docs", arguments: { query: query, limit: limit } })
28
+ end
29
+
30
+ def read_doc(path)
31
+ rpc("/mcp/docs", "tools/call", { name: "read_doc", arguments: { path: path } })
32
+ end
33
+
34
+ def list_docs
35
+ rpc("/mcp/docs", "tools/call", { name: "list_docs", arguments: {} })
36
+ end
37
+
38
+ def read_markdown(path)
39
+ clean = path.start_with?("/") ? path : "/#{path}"
40
+ target = clean == "/" ? "/index.md" : "#{clean.delete_suffix('.md')}.md"
41
+ request(:get, target, accept: "text/markdown")
42
+ end
43
+
44
+ def tools
45
+ rpc("/mcp/v1", "tools/list")
46
+ end
47
+
48
+ def call_tool(name, arguments = {}, token: nil)
49
+ bearer = token || @token
50
+ unless bearer
51
+ raise Error.new(
52
+ "Calling #{name} needs a token, because every tool reads one person's own CRM. " \
53
+ "Mint one at #{@base_url}/user/mcp and set YOUSPOT_TOKEN, or read #{@base_url}/auth.md " \
54
+ "for the OAuth flow.", code: "no_token"
55
+ )
56
+ end
57
+ rpc("/mcp/v1", "tools/call", { name: name, arguments: arguments }, token: bearer)
58
+ end
59
+
60
+ def sandbox_tools
61
+ rpc("/mcp/sandbox", "tools/list")
62
+ end
63
+
64
+ def call_sandbox_tool(name, arguments = {})
65
+ rpc("/mcp/sandbox", "tools/call", { name: name, arguments: arguments })
66
+ end
67
+
68
+ def identity(type = "anonymous")
69
+ request(:post, "/agent/identity", body: { type: type }, token: @token)
70
+ end
71
+
72
+ def member(username)
73
+ get("/api/human/#{URI.encode_www_form_component(username)}")
74
+ end
75
+
76
+ def directory(limit: 20, page: 1)
77
+ get("/api/network/members", query: { limit: limit, page: page })
78
+ end
79
+
80
+ def batch(requests)
81
+ request(:post, "/api/batch", body: { requests: requests }, token: @token)
82
+ end
83
+
84
+ private
85
+
86
+ def get(path, query: nil)
87
+ target = query ? "#{path}?#{URI.encode_www_form(query)}" : path
88
+ request(:get, target)
89
+ end
90
+
91
+ def rpc(path, method, params = nil, token: nil)
92
+ body = { jsonrpc: "2.0", id: 1, method: method }
93
+ body[:params] = params if params
94
+ answer = request(:post, path, body: body, token: token)
95
+ if answer.key?("error")
96
+ error = answer["error"]
97
+ raise Error.new(error["message"] || "JSON-RPC error", code: error["code"].to_s, url: @base_url + path)
98
+ end
99
+ answer["result"]
100
+ end
101
+
102
+ def request(method, path, body: nil, token: nil, accept: "application/json")
103
+ uri = URI.parse(@base_url + path)
104
+ klass = method == :post ? Net::HTTP::Post : Net::HTTP::Get
105
+ req = klass.new(uri)
106
+ req["Accept"] = accept
107
+ req["User-Agent"] = "youspot-ruby/#{VERSION}"
108
+ req["Authorization"] = "Bearer #{token}" if token
109
+ if body
110
+ req["Content-Type"] = "application/json"
111
+ req.body = JSON.generate(body)
112
+ end
113
+ response = begin
114
+ Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https", read_timeout: 60) do |http|
115
+ http.request(req)
116
+ end
117
+ rescue SystemCallError, SocketError, Timeout::Error => e
118
+ raise Error.new("#{uri} could not be reached: #{e.message}", url: uri.to_s)
119
+ end
120
+ status = response.code.to_i
121
+ text = response.body.to_s
122
+
123
+ if accept != "application/json"
124
+ raise Error.new("#{uri} answered #{status}", status: status, url: uri.to_s) if status >= 400
125
+
126
+ return text
127
+ end
128
+
129
+ parsed = text.empty? ? {} : JSON.parse(text)
130
+ raise api_error(parsed, status, uri.to_s) if status >= 400
131
+
132
+ parsed
133
+ rescue JSON::ParserError
134
+ raise Error.new("#{uri} answered #{status} with something other than JSON", status: status, url: uri.to_s)
135
+ end
136
+
137
+ def api_error(parsed, status, url)
138
+ error = parsed["error"]
139
+ code = error.is_a?(Hash) ? error["code"] : error
140
+ message = parsed["error_description"] ||
141
+ (error.is_a?(Hash) ? error["message"] : error) ||
142
+ "#{url} answered #{status}"
143
+ Error.new(message, status: status, code: code, url: url)
144
+ end
145
+ end
146
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YouSpot
4
+ VERSION = "0.1.0"
5
+ end
data/lib/youspot.rb ADDED
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "youspot/version"
4
+ require_relative "youspot/client"
5
+
6
+ # The official Ruby client for YouSpot, the AI-native personal CRM.
7
+ #
8
+ # Everything except +call_tool+ works with no credential. A token always
9
+ # belongs to a person, because every tool reads one person's own CRM.
10
+ module YouSpot
11
+ class Error < StandardError
12
+ attr_reader :status, :code, :url
13
+
14
+ def initialize(message, status: nil, code: nil, url: nil)
15
+ super(message)
16
+ @status = status
17
+ @code = code
18
+ @url = url
19
+ end
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: youspot
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - YouSpot, Inc.
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2026-09-17 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: minitest
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '5.0'
19
+ type: :development
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '5.0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: rake
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '13.0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '13.0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: webrick
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.7'
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.7'
54
+ description: Ask questions, read the docs, list and call the MCP tools, try them in
55
+ the sandbox, and read the public member directory at youspot.com. Standard library
56
+ only; only calling a tool needs a member's token.
57
+ email:
58
+ - support@youspot.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - CHANGELOG.md
64
+ - LICENSE
65
+ - README.md
66
+ - lib/youspot.rb
67
+ - lib/youspot/client.rb
68
+ - lib/youspot/version.rb
69
+ homepage: https://youspot.com
70
+ licenses:
71
+ - MIT
72
+ metadata:
73
+ homepage_uri: https://youspot.com
74
+ documentation_uri: https://youspot.com/docs/api
75
+ source_code_uri: https://github.com/OnStartups/youspot-ruby
76
+ changelog_uri: https://github.com/OnStartups/youspot-ruby/blob/main/CHANGELOG.md
77
+ bug_tracker_uri: https://youspot.com/support
78
+ rubygems_mfa_required: 'true'
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '2.7'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubygems_version: 3.6.2
94
+ specification_version: 4
95
+ summary: Official Ruby client for YouSpot, the AI-native personal CRM
96
+ test_files: []