README.md in backlog_kit-0.11.0 vs README.md in backlog_kit-0.12.0
- old
+ new
@@ -29,37 +29,88 @@
## Usage
```ruby
require 'backlog_kit'
-client = BacklogKit::Client.new(space_id: 'emsk', api_key: '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234')
+client = BacklogKit::Client.new(
+ space_id: 'emsk',
+ api_key: '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234'
+)
-client.get('space').body # get body
-client.get('space').headers # get headers
-client.get('space').status # get status
+client.get_space.body # get body
+client.get_space.headers # get headers
+client.get_space.status # get status
-client.get('space/activities') # no params
-client.get('space/activities', activity_type_id: [1, 4], min_id: 100) # underscored key
-client.get('space/activities', activityTypeId: [1, 4], minId: 100) # camelized key
+client.get_space_activities # no params
+client.get_space_activities(activity_type_id: [1, 4], min_id: 100) # underscored key
+client.get_space_activities(activityTypeId: [1, 4], minId: 100) # camelized key
-client.post('groups', name: 'beer') # POST method
-client.put('space/notification', content: 'Cheers!') # PUT method
-client.patch('groups/3712', name: 'whiskey') # PATCH method
-client.delete('groups/3712') # DELETE method
+client.get_groups.body[0].members[0].mail_address # method chaining
```
+You can also use low-level methods.
+
+```ruby
+client.get('projects/1234/customFields') # GET
+client.post('groups', name: 'beer') # POST
+client.put('space/notification', content: 'Cheers!') # PUT
+client.patch('groups/3712', name: 'whiskey') # PATCH
+client.delete('groups/3712') # DELETE
+```
+
+## Authentication
+
+### API Key
+
+```ruby
+client = BacklogKit::Client.new(
+ space_id: 'emsk',
+ api_key: '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234'
+)
+```
+
+### OAuth access token
+
+```ruby
+client = BacklogKit::Client.new(
+ space_id: 'emsk',
+ api_key: nil, # api_key should be nil
+ access_token: 'abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcd'
+)
+```
+
## ENV
| ENV Variable | Description |
| :----------- | :---------- |
| `BACKLOG_SPACE_ID` | Your Backlog SPACE ID. |
| `BACKLOG_API_KEY` | Your Backlog API KEY. |
+| `BACKLOG_OAUTH_CLIENT_ID` | CLIENT ID of your Backlog application. |
+| `BACKLOG_OAUTH_CLIENT_SECRET` | CLIENT SECRET of your Backlog application. |
+| `BACKLOG_OAUTH_REFRESH_TOKEN` | REFRESH TOKEN obtained from the Backlog token endpoint. |
You can create instance more easily.
```ruby
client = BacklogKit::Client.new
```
+
+## Supported API
+
+* Git
+* Group
+* Issue
+* Notification
+* Priority
+* Project
+* Resolution
+* Space
+* Star
+* Status
+* User
+* Wiki
+
+See [RDoc](http://www.rubydoc.info/gems/backlog_kit) for more details.
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.