Skip to content

Commit 292d980

Browse files
committed
Release v0.1.0
1 parent 90899b3 commit 292d980

50 files changed

Lines changed: 2381 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/rspec.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: RSpec
2+
3+
on:
4+
push:
5+
branches: [ '**' ]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
ruby-version: ['3.2', '3.3', '3.4']
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up Ruby
19+
uses: ruby/setup-ruby@v1
20+
with:
21+
ruby-version: ${{ matrix.ruby-version }}
22+
bundler-cache: true
23+
- name: Install dependencies
24+
run: bundle install
25+
- name: Run tests
26+
run: bundle exec rspec

.github/workflows/rubocop.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: RuboCop
2+
3+
on:
4+
push:
5+
branches: [ '**' ]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
rubocop:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Set up Ruby
15+
uses: ruby/setup-ruby@v1
16+
with:
17+
ruby-version: 3.2
18+
bundler-cache: true
19+
- name: Install dependencies
20+
run: bundle install
21+
- name: Run RuboCop
22+
run: bundle exec rubocop

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/.bundle/
2+
/.yardoc
3+
/_yardoc/
4+
/coverage/
5+
/doc/
6+
/pkg/
7+
/spec/reports/
8+
/tmp/
9+
*.gem
10+
*.rbc
11+
.DS_Store
12+
Gemfile.lock
13+
spec/examples.txt

.rspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--color

.rubocop.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
AllCops:
2+
TargetRubyVersion: 3.2
3+
NewCops: enable
4+
5+
Style/StringLiterals:
6+
Enabled: true
7+
EnforcedStyle: single_quotes
8+
9+
Style/StringLiteralsInInterpolation:
10+
Enabled: true
11+
EnforcedStyle: single_quotes
12+
13+
Layout/LineLength:
14+
Max: 180
15+
16+
Metrics/MethodLength:
17+
Max: 20
18+
19+
Metrics/AbcSize:
20+
Max: 30
21+
22+
Metrics/ClassLength:
23+
Max: 200
24+
25+
Metrics/BlockLength:
26+
Exclude:
27+
- 'spec/**/*'
28+
- '*.gemspec'
29+
30+
Metrics/CyclomaticComplexity:
31+
Max: 15
32+
33+
# Disable warnings about development dependencies in gemspec
34+
Gemspec/DevelopmentDependencies:
35+
Enabled: false
36+
37+
# Disable warnings about missing documentation
38+
Style/Documentation:
39+
Enabled: false

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
## [Unreleased]
4+
5+
## [0.1.0] - 2025-05-18
6+
7+
* Initial version of the Devin API client

Gemfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# frozen_string_literal: true
2+
3+
source 'https://rubygems.org'
4+
5+
gem 'rake'
6+
gem 'yard'
7+
8+
group :test do
9+
gem 'rspec'
10+
gem 'vcr'
11+
gem 'webmock'
12+
end
13+
14+
group :development do
15+
gem 'bump'
16+
gem 'rubocop', require: false
17+
end
18+
19+
group :development, :test do
20+
gem 'byebug', platforms: :ruby
21+
end
22+
23+
gemspec

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Masato Sugiyama
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.

README.md

Lines changed: 136 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,136 @@
1-
# devin_api
1+
# Devin API Client
2+
[![Test](https://github.com/smasato/devin_api_client_rb/actions/workflows/rspec.yml/badge.svg)](https://github.com/smasato/devin_api_client_rb/actions/workflows/rspec.yml?query=branch%3Amain)
3+
4+
This Ruby gem is a client for the Devin API.
5+
6+
This gem is not officially supported by Cognition AI, Inc.
7+
8+
## Installation
9+
10+
Add this line to your application's Gemfile:
11+
12+
```ruby
13+
gem 'devin_api'
14+
```
15+
16+
And then execute:
17+
18+
```bash
19+
$ bundle install
20+
```
21+
22+
Or install it yourself as:
23+
24+
```bash
25+
$ gem install devin_api
26+
```
27+
28+
## Usage
29+
30+
### Endpoint-based API
31+
32+
```ruby
33+
require 'devin_api'
34+
35+
client = DevinApi::Client.new do |config|
36+
config.url = 'https://api.devin.ai'
37+
config.access_token = 'your_access_token'
38+
end
39+
40+
# Sessions
41+
sessions = client.list_sessions(limit: 10)
42+
puts "Sessions: #{sessions}"
43+
44+
new_session = client.create_session(prompt: 'Build a simple web app')
45+
session_id = new_session['id']
46+
puts "Created session: #{session_id}"
47+
48+
session_details = client.get_session(session_id)
49+
puts "Session details: #{session_details}"
50+
51+
message_response = client.send_message(session_id, message: 'How do I start?')
52+
puts "Message response: #{message_response}"
53+
54+
# Upload files to a session
55+
file = File.open('path/to/file.txt')
56+
upload_response = client.upload_file(file)
57+
puts "Upload response: #{upload_response}"
58+
59+
# Update session tags
60+
tags_response = client.update_session_tags(session_id, tags: ['web', 'app'])
61+
puts "Tags update response: #{tags_response}"
62+
63+
# Secrets
64+
secrets = client.list_secrets
65+
puts "Secrets: #{secrets}"
66+
67+
# Knowledge
68+
knowledge_items = client.list_knowledge
69+
puts "Knowledge items: #{knowledge_items}"
70+
71+
new_knowledge = client.create_knowledge(
72+
name: 'API Documentation',
73+
body: 'This is the API documentation for our service.',
74+
trigger_description: 'When API documentation is needed'
75+
)
76+
knowledge_id = new_knowledge['id']
77+
puts "Created knowledge: #{knowledge_id}"
78+
79+
# Enterprise (for enterprise customers)
80+
audit_logs = client.list_audit_logs(start_time: '2023-01-01T00:00:00Z')
81+
puts "Audit logs: #{audit_logs}"
82+
83+
consumption = client.get_enterprise_consumption(period: 'current_month')
84+
puts "Consumption: #{consumption}"
85+
```
86+
87+
### Resource-based API
88+
89+
```ruby
90+
require 'devin_api'
91+
92+
client = DevinApi::Client.new do |config|
93+
config.url = 'https://api.devin.ai'
94+
config.access_token = 'your_access_token'
95+
end
96+
97+
# Resource-based usage
98+
# Get a collection of sessions
99+
sessions = client.sessions
100+
sessions.each do |session|
101+
puts "Session ID: #{session.id}, Prompt: #{session[:prompt]}"
102+
end
103+
104+
# Create a new session
105+
new_session = client.sessions.create(prompt: 'Build a simple web app')
106+
puts "Created session: #{new_session.session_id}"
107+
108+
# Get a specific session
109+
session = client.session('session_id')
110+
111+
# Send a message to the session
112+
response = session.send_message('How do I start?')
113+
114+
# Upload files to the session
115+
files = [File.open('path/to/file.txt')]
116+
upload_response = session.upload_files(files)
117+
118+
# Update session tags
119+
session.update_tags(['web', 'app'])
120+
121+
# Pagination
122+
next_page = sessions.next_page
123+
if next_page
124+
next_page.each do |session|
125+
puts "Next page session: #{session.id}"
126+
end
127+
end
128+
```
129+
130+
## Contributing
131+
132+
Bug reports and pull requests are welcome on GitHub at https://github.com/smasato/devin_api_client_rb.
133+
134+
## License
135+
136+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

Rakefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# frozen_string_literal: true
2+
3+
require 'bundler/gem_tasks'
4+
require 'rspec/core/rake_task'
5+
require 'rubocop/rake_task'
6+
7+
RSpec::Core::RakeTask.new(:spec)
8+
RuboCop::RakeTask.new
9+
10+
task default: %i[spec rubocop]

0 commit comments

Comments
 (0)