leash-sdk 0.2.0 → 0.2.1

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +29 -109
  3. data/lib/leash.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1c51a2f51cd93a5950ac251adab5eeb1b1787175732dd4e4804574175cf699e
4
- data.tar.gz: 9fc45a6f2808e76f84b1f82c38891c1085865cdd97f6ad31663d8ef9683f923a
3
+ metadata.gz: 326ce87e27b0aec22d2cf9175c3ed7b170b493a7e7eb86b55fc115806b5c84a1
4
+ data.tar.gz: a4cced54f08f447c0dc703524c6ce84fcd07173f685f6a8ee0e76dc3dda1065a
5
5
  SHA512:
6
- metadata.gz: 972c62c6db4c16b31b64fcfe7b8e2d60e27fb708e306801f3d895351c5f7f75c09a83c6a2a5b7a89bbe886cf41c5136b031a8b27f2509287198c004d572d6d95
7
- data.tar.gz: 9802de6dea20a65d7cd196fc50b4ebc67ebbd489fa57c53ae19a0cc6d4ffb928faa62e34c2560403f7f0746aba24f68747111d6afa24aad0887b1601b95d26ea
6
+ metadata.gz: fba497998357aaaa579aec3d3c3539f73c1a2871b8dfc9922dc9ce7e7d238f3587bd12c4a6ccf50e0cf9a149e1926915218aa270f775091d39cb6c2d9025d059
7
+ data.tar.gz: db78fcf8d0e38fc9f575dc03d0612d2e3ce228dbc0869e23d609e18604f1b634929e3215ac66c480f0730c50e2c8c666203b67eb31dd960d461eadb7ccc66a03
data/README.md CHANGED
@@ -1,18 +1,18 @@
1
1
  # Leash SDK for Ruby
2
2
 
3
- Ruby SDK for the [Leash](https://leash.build) platform integrations API. Access Gmail, Google Calendar, Google Drive, and more through the Leash platform proxy.
3
+ Ruby SDK for Leash-hosted integrations.
4
4
 
5
- ## Installation
5
+ Use it to call Gmail, Google Calendar, Google Drive, and custom provider actions through the Leash platform proxy.
6
6
 
7
- Add to your Gemfile:
7
+ ## Installation
8
8
 
9
9
  ```ruby
10
10
  gem "leash-sdk"
11
11
  ```
12
12
 
13
- Or install directly:
13
+ or:
14
14
 
15
- ```
15
+ ```bash
16
16
  gem install leash-sdk
17
17
  ```
18
18
 
@@ -21,120 +21,40 @@ gem install leash-sdk
21
21
  ```ruby
22
22
  require "leash"
23
23
 
24
- client = Leash::Integrations.new(auth_token: ENV["LEASH_AUTH_TOKEN"])
25
-
26
- # Gmail
27
- messages = client.gmail.list_messages(query: "is:unread", max_results: 10)
28
- message = client.gmail.get_message("msg_id_123")
29
- client.gmail.send_message(to: "friend@example.com", subject: "Hello", body: "Hi there!")
30
- labels = client.gmail.list_labels
31
-
32
- # Google Calendar
33
- calendars = client.calendar.list_calendars
34
- events = client.calendar.list_events(
35
- time_min: "2026-04-10T00:00:00Z",
36
- time_max: "2026-04-17T00:00:00Z",
37
- single_events: true,
38
- order_by: "startTime"
39
- )
40
- client.calendar.create_event(
41
- summary: "Team standup",
42
- start: { "dateTime" => "2026-04-11T09:00:00-04:00" },
43
- end_time: { "dateTime" => "2026-04-11T09:30:00-04:00" }
24
+ client = Leash::Integrations.new(
25
+ auth_token: ENV["LEASH_AUTH_TOKEN"],
26
+ api_key: ENV["LEASH_API_KEY"]
44
27
  )
45
28
 
46
- # Google Drive
47
- files = client.drive.list_files
48
- file = client.drive.get_file("file_id_123")
49
- results = client.drive.search_files("quarterly report", max_results: 5)
50
- ```
51
-
52
- ## Connection Management
53
-
54
- ```ruby
55
- # Check if a provider is connected
56
- client.connected?("gmail") # => true/false
57
-
58
- # Get all connections
59
- client.connections # => [{ "providerId" => "gmail", "status" => "active", ... }]
60
-
61
- # Get OAuth connect URL (for UI buttons)
62
- url = client.connect_url("gmail", return_url: "https://myapp.com/settings")
63
- ```
64
-
65
- ## Error Handling
66
-
67
- ```ruby
68
- begin
69
- client.gmail.list_messages
70
- rescue Leash::NotConnectedError => e
71
- # Redirect user to connect: e.connect_url
72
- puts "Please connect Gmail: #{e.connect_url}"
73
- rescue Leash::TokenExpiredError => e
74
- # Token needs refresh: e.connect_url
75
- puts "Token expired, reconnect: #{e.connect_url}"
76
- rescue Leash::Error => e
77
- # General API error
78
- puts "Error (#{e.code}): #{e.message}"
29
+ if client.connected?("gmail")
30
+ messages = client.gmail.list_messages(max_results: 5)
31
+ puts messages
32
+ else
33
+ puts client.connect_url("gmail", return_url: "https://myapp.example.com/settings")
79
34
  end
80
35
  ```
81
36
 
82
- ## Configuration
83
-
84
- ```ruby
85
- # Custom platform URL
86
- client = Leash::Integrations.new(
87
- auth_token: "your-token",
88
- platform_url: "https://your-instance.leash.build"
89
- )
90
- ```
91
-
92
- ## API Reference
93
-
94
- ### `Leash::Integrations.new(auth_token:, platform_url: "https://leash.build")`
95
-
96
- Creates a new client instance.
97
-
98
- ### Gmail (`client.gmail`)
99
-
100
- | Method | Description |
101
- |--------|-------------|
102
- | `list_messages(query:, max_results:, label_ids:, page_token:)` | List messages |
103
- | `get_message(message_id, format:)` | Get a message by ID |
104
- | `send_message(to:, subject:, body:, cc:, bcc:)` | Send an email |
105
- | `search_messages(query, max_results:)` | Search messages |
106
- | `list_labels` | List all labels |
107
-
108
- ### Calendar (`client.calendar`)
109
-
110
- | Method | Description |
111
- |--------|-------------|
112
- | `list_calendars` | List all calendars |
113
- | `list_events(calendar_id:, time_min:, time_max:, max_results:, single_events:, order_by:)` | List events |
114
- | `create_event(summary:, start:, end_time:, calendar_id:, description:, location:, attendees:)` | Create an event |
115
- | `get_event(event_id, calendar_id:)` | Get an event by ID |
116
-
117
- ### Drive (`client.drive`)
37
+ ## Default Platform URL
118
38
 
119
- | Method | Description |
120
- |--------|-------------|
121
- | `list_files(query:, max_results:, folder_id:)` | List files |
122
- | `get_file(file_id)` | Get file metadata |
123
- | `search_files(query, max_results:)` | Search files |
39
+ - `https://leash.build`
124
40
 
125
- ### Connections
41
+ ## Features
126
42
 
127
- | Method | Description |
128
- |--------|-------------|
129
- | `connected?(provider_id)` | Check if provider is connected |
130
- | `connections` | Get all connection statuses |
131
- | `connect_url(provider_id, return_url:)` | Get OAuth connect URL |
43
+ - Gmail
44
+ - Google Calendar
45
+ - Google Drive
46
+ - connection status lookup
47
+ - connect URL generation
48
+ - generic provider calls
49
+ - custom integration calls
50
+ - app env fetch and caching
132
51
 
133
- ## Requirements
52
+ ## Notes
134
53
 
135
- - Ruby >= 3.0
136
- - No external dependencies (uses stdlib `net/http`, `json`, `uri`)
54
+ - `auth_token` should be a valid Leash platform JWT
55
+ - `api_key` is optional, but useful for app-scoped access
56
+ - OAuth token handling remains a platform concern
137
57
 
138
58
  ## License
139
59
 
140
- MIT
60
+ Apache-2.0
data/lib/leash.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  require_relative "leash/integrations"
4
4
 
5
5
  module Leash
6
- VERSION = "0.2.0"
6
+ VERSION = "0.2.1"
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leash-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leash
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-04-14 00:00:00.000000000 Z
11
+ date: 2026-04-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Access Gmail, Google Calendar, Google Drive, and more through the Leash
14
14
  platform proxy. No API keys needed -- uses your Leash auth token.