Skip to content

Commit e02e800

Browse files
committed
Customize the README with clearer instructions
1 parent 4c96390 commit e02e800

File tree

1 file changed

+47
-56
lines changed

1 file changed

+47
-56
lines changed

README.md

Lines changed: 47 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,77 @@
1-
# patch_ruby
1+
# Patch ruby
2+
![Test](https://github.com/patch-technology/patch-ruby/workflows/Test/badge.svg)
23

3-
PatchRuby - the Ruby gem for the Patch API V1
4+
The official Ruby gem for the [Patch API](https://www.usepatch.com)
45

5-
The core API used to integrate with Patch's service
6+
## Documentation
67

7-
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
8-
9-
- API version: v1
10-
- Package version: 1.0.0
11-
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
8+
For detailed documentation and examples, see the [Patch API docs](https://www.usepatch.com).
129

1310
## Installation
1411

15-
### Build a gem
16-
17-
To build the Ruby code into a gem:
18-
19-
```shell
20-
gem build patch_ruby.gemspec
12+
Add the gem to your Gemfile:
13+
```ruby
14+
gem 'patch_ruby'
2115
```
2216

23-
Then either install the gem locally:
24-
17+
Then run:
2518
```shell
26-
gem install ./patch_ruby-1.0.0.gem
19+
bundle
2720
```
2821

29-
(for development, run `gem install --dev ./patch_ruby-1.0.0.gem` to install the development dependencies)
30-
31-
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
32-
33-
Finally add this to the Gemfile:
34-
35-
gem 'patch_ruby', '~> 1.0.0'
36-
37-
### Install from Git
38-
39-
If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:
40-
41-
gem 'patch_ruby', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
42-
43-
### Include the Ruby code directly
44-
45-
Include the Ruby code directly using `-I` as follows:
46-
22+
Or install it directly with
4723
```shell
48-
ruby -Ilib script.rb
24+
gem install patch_ruby
4925
```
5026

51-
## Getting Started
27+
### Requirements
28+
- Ruby 1.9+
5229

53-
Please follow the [installation](#installation) procedure and then run the following code:
30+
## Usage
5431

32+
After installing the gem, you'll have to configure it with your API key which is available from the API key page in the Patch dashboard:
5533
```ruby
56-
# Load the gem
5734
require 'patch_ruby'
5835

59-
# Setup authorization
6036
PatchRuby.configure do |config|
61-
# Configure Bearer authorization: bearer_auth
62-
config.access_token = 'YOUR_BEARER_TOKEN'
37+
# Configure the Patch gem with your API key here
38+
config.access_token = 'key_test_1234'
6339
end
40+
```
6441

65-
api_instance = PatchRuby::OrdersApi.new
66-
id = 'id_example' # String |
42+
Once configured, you can test it out:
43+
```ruby
44+
# Retrieve and print all your orders
45+
orders_api = PatchRuby::OrdersApi.new
6746

6847
begin
69-
#Cancel an order
70-
result = api_instance.cancel_order(id)
71-
p result
48+
orders_response = orders_api.retrieve_orders
49+
50+
orders_response.data.each do |order|
51+
puts "Order ID: #{order.id}, Order State: #{order.state}"
52+
end
53+
# Rescue from any Patch API errors
7254
rescue PatchRuby::ApiError => e
73-
puts "Exception when calling OrdersApi->cancel_order: #{e}"
55+
puts "Failed to retrieve Orders with status code #{e.code}: #{e.message}"
7456
end
57+
```
7558

59+
## Development
60+
61+
Install dependencies:
62+
```shell
63+
bundle install --path vendor/bundle
64+
```
65+
66+
Run tests:
67+
```shell
68+
bundle exec rspec
69+
```
70+
71+
Building and installing the gem locally:
72+
```shell
73+
gem build patch_ruby.gemspec
74+
gem install patch_ruby-<version>.gem
7675
```
7776

7877
## Documentation for API Endpoints
@@ -108,11 +107,3 @@ Class | Method | HTTP request | Description
108107
- [PatchRuby::ProjectListResponse](docs/ProjectListResponse.md)
109108
- [PatchRuby::ProjectResponse](docs/ProjectResponse.md)
110109

111-
112-
## Documentation for Authorization
113-
114-
115-
### bearer_auth
116-
117-
- **Type**: Bearer authentication
118-

0 commit comments

Comments
 (0)