tacokit 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/.pryrc +7 -0
- data/.rspec +2 -0
- data/.travis.yml +18 -0
- data/Gemfile +28 -0
- data/Guardfile +12 -0
- data/LICENSE +22 -0
- data/README.md +134 -0
- data/Rakefile +8 -0
- data/config.ru +7 -0
- data/lib/tacokit/authorization.rb +46 -0
- data/lib/tacokit/client/actions.rb +54 -0
- data/lib/tacokit/client/boards.rb +124 -0
- data/lib/tacokit/client/cards.rb +143 -0
- data/lib/tacokit/client/checklists.rb +59 -0
- data/lib/tacokit/client/labels.rb +44 -0
- data/lib/tacokit/client/lists.rb +54 -0
- data/lib/tacokit/client/members.rb +91 -0
- data/lib/tacokit/client/notifications.rb +48 -0
- data/lib/tacokit/client/organizations.rb +79 -0
- data/lib/tacokit/client/searches.rb +20 -0
- data/lib/tacokit/client/tokens.rb +41 -0
- data/lib/tacokit/client/types.rb +11 -0
- data/lib/tacokit/client/webhooks.rb +43 -0
- data/lib/tacokit/client.rb +169 -0
- data/lib/tacokit/configuration.rb +60 -0
- data/lib/tacokit/error.rb +31 -0
- data/lib/tacokit/middleware/boom.rb +26 -0
- data/lib/tacokit/middleware/debug.rb +22 -0
- data/lib/tacokit/middleware.rb +15 -0
- data/lib/tacokit/resource.rb +114 -0
- data/lib/tacokit/response.rb +23 -0
- data/lib/tacokit/transform.rb +97 -0
- data/lib/tacokit/utils.rb +51 -0
- data/lib/tacokit/version.rb +3 -0
- data/lib/tacokit.rb +20 -0
- data/script/console +6 -0
- data/spec/cassettes/Tacokit_Client/_connection/authorized_GET_request_with_app_key_and_token_params.json +1 -0
- data/spec/cassettes/Tacokit_Client_Actions/_action/returns_a_token_authorized_action.json +1 -0
- data/spec/cassettes/Tacokit_Client_Actions/_action/returns_oauth_authorized_board.json +1 -0
- data/spec/cassettes/Tacokit_Client_Actions/_action_field/returns_a_hash.json +1 -0
- data/spec/cassettes/Tacokit_Client_Actions/_action_field/returns_a_resource.json +1 -0
- data/spec/cassettes/Tacokit_Client_Actions/_action_field/returns_a_value.json +1 -0
- data/spec/cassettes/Tacokit_Client_Actions/_action_resource/returns_action_board.json +1 -0
- data/spec/cassettes/Tacokit_Client_Actions/_action_resource/returns_action_entities.json +1 -0
- data/spec/cassettes/Tacokit_Client_Actions/_action_resource/returns_action_memberships.json +1 -0
- data/spec/cassettes/Tacokit_Client_Actions/_delete_action/deletes_an_action.json +1 -0
- data/spec/cassettes/Tacokit_Client_Actions/_update_action/updates_a_action.json +1 -0
- data/spec/cassettes/Tacokit_Client_Actions/_update_action/updates_an_action.json +1 -0
- data/spec/cassettes/Tacokit_Client_Actions/_update_action_text/updates_an_action.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_add_board_member/adds_invites_member_to_board.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_board/returns_a_token_authorized_board.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_board/returns_oauth_authorized_board.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_board_field/returns_a_hash.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_board_field/returns_a_value.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_board_field/returns_an_array.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_board_resource/returns_board_actions.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_board_resource/returns_board_cards.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_board_resource/returns_board_members.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_create_board/creates_a_board.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_create_board_resource/creates_a_board_calendar_key.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_create_board_resource/creates_a_board_label.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_create_board_resource/creates_a_board_resource.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_update_board/updates_a_board.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_update_board/updates_nested_resource.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_update_board_field/updates_a_board_field.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_update_board_resource/updates_member.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_card/returns_a_card_by_id.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_card/returns_a_card_by_short_link.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_card_field/returns_a_hash.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_card_field/returns_a_value.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_card_field/returns_an_array.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_card_resource/returns_card_actions.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_card_resource/returns_card_board.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_card_resource/returns_card_check_item_states.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_create_card/creates_a_card.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_create_card_attachment/attaches_external_url.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_create_card_attachment/uploads_local_file.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_create_card_comment/creates_a_comment.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_delete_card/deletes_a_card.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_delete_card_resource/deletes_resource.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_update_card/updates_a_card.json +1 -0
- data/spec/cassettes/Tacokit_Client_Checklists/_checklist/returns_a_checklist_by_id.json +1 -0
- data/spec/cassettes/Tacokit_Client_Checklists/_checklist_field/returns_a_value.json +1 -0
- data/spec/cassettes/Tacokit_Client_Checklists/_checklist_resource/returns_checklist_actions.json +1 -0
- data/spec/cassettes/Tacokit_Client_Checklists/_checklist_resource/returns_checklist_board.json +1 -0
- data/spec/cassettes/Tacokit_Client_Checklists/_checklist_resource/returns_checklist_prefs.json +1 -0
- data/spec/cassettes/Tacokit_Client_Checklists/_create_checklist/creates_a_checklist.json +1 -0
- data/spec/cassettes/Tacokit_Client_Checklists/_delete_checklist/deletes_a_checklist.json +1 -0
- data/spec/cassettes/Tacokit_Client_Checklists/_update_checklist/updates_a_checklist.json +1 -0
- data/spec/cassettes/Tacokit_Client_Labels/_create_label/creates_a_label.json +1 -0
- data/spec/cassettes/Tacokit_Client_Labels/_delete_label/deletes_a_label.json +1 -0
- data/spec/cassettes/Tacokit_Client_Labels/_label/returns_a_label_by_id.json +1 -0
- data/spec/cassettes/Tacokit_Client_Labels/_label_resource/returns_a_board.json +1 -0
- data/spec/cassettes/Tacokit_Client_Labels/_labels/returns_a_label_by_id.json +1 -0
- data/spec/cassettes/Tacokit_Client_Labels/_update_label/updates_a_label.json +1 -0
- data/spec/cassettes/Tacokit_Client_Lists/_create_list/creates_a_list.json +1 -0
- data/spec/cassettes/Tacokit_Client_Lists/_list/returns_a_list_by_id.json +1 -0
- data/spec/cassettes/Tacokit_Client_Lists/_list_field/returns_a_value.json +1 -0
- data/spec/cassettes/Tacokit_Client_Lists/_list_resource/returns_list_actions.json +1 -0
- data/spec/cassettes/Tacokit_Client_Lists/_list_resource/returns_list_board.json +1 -0
- data/spec/cassettes/Tacokit_Client_Lists/_list_resource/returns_list_cards.json +1 -0
- data/spec/cassettes/Tacokit_Client_Lists/_update_list/updates_a_list.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_member/authenticated/returns_self.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_member/raises_error_for_missing_token.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_member/returns_a_member.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_member/returns_self.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_member/supports_query_fields_as_string_or_array.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_member_field/returns_a_hash.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_member_field/returns_a_member_field.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_member_field/returns_a_resource.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_member_field/returns_a_value.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_member_field/returns_an_array.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_member_resource/returns_member_actions.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_member_resource/returns_member_board_stars.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_member_resource/returns_member_boards.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_update_member/updates_a_member.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_update_member/updates_nested_resource.json +1 -0
- data/spec/cassettes/Tacokit_Client_Notifications/_notification/returns_a_notification_by_id.json +1 -0
- data/spec/cassettes/Tacokit_Client_Notifications/_notification_field/returns_a_hash.json +1 -0
- data/spec/cassettes/Tacokit_Client_Notifications/_notification_field/returns_a_resource.json +1 -0
- data/spec/cassettes/Tacokit_Client_Notifications/_notification_field/returns_a_value.json +1 -0
- data/spec/cassettes/Tacokit_Client_Notifications/_notification_resource/returns_action_entities.json +1 -0
- data/spec/cassettes/Tacokit_Client_Notifications/_notification_resource/returns_notification_board.json +1 -0
- data/spec/cassettes/Tacokit_Client_Notifications/_update_notification/updates_a_notification.json +1 -0
- data/spec/cassettes/Tacokit_Client_Organizations/_create_organization/creates_a_organization.json +1 -0
- data/spec/cassettes/Tacokit_Client_Organizations/_delete_organization/deletes_a_organization.json +1 -0
- data/spec/cassettes/Tacokit_Client_Organizations/_organization/returns_an_organization_by_id.json +1 -0
- data/spec/cassettes/Tacokit_Client_Organizations/_organization_field/returns_a_hash.json +1 -0
- data/spec/cassettes/Tacokit_Client_Organizations/_organization_field/returns_a_resource.json +1 -0
- data/spec/cassettes/Tacokit_Client_Organizations/_organization_field/returns_a_value.json +1 -0
- data/spec/cassettes/Tacokit_Client_Organizations/_organization_field/returns_an_array.json +1 -0
- data/spec/cassettes/Tacokit_Client_Organizations/_organization_resource/returns_organization_actions.json +1 -0
- data/spec/cassettes/Tacokit_Client_Organizations/_organization_resource/returns_organization_boards.json +1 -0
- data/spec/cassettes/Tacokit_Client_Organizations/_organization_resource/returns_organization_members.json +1 -0
- data/spec/cassettes/Tacokit_Client_Organizations/_update_organization/updates_a_organization.json +1 -0
- data/spec/cassettes/Tacokit_Client_Searches/_search/returns_search_result.json +1 -0
- data/spec/cassettes/Tacokit_Client_Tokens/_delete_token/deletes_a_token.json +1 -0
- data/spec/cassettes/Tacokit_Client_Tokens/_token/returns_a_token_for_token_string.json +1 -0
- data/spec/cassettes/Tacokit_Client_Tokens/_token_field/returns_a_value.json +1 -0
- data/spec/cassettes/Tacokit_Client_Tokens/_token_field/returns_an_array.json +1 -0
- data/spec/cassettes/Tacokit_Client_Tokens/_token_resource/returns_token_member.json +1 -0
- data/spec/cassettes/Tacokit_Client_Tokens/_token_resource/returns_token_webhooks.json +1 -0
- data/spec/cassettes/Tacokit_Client_Types/_type/returns_a_type_by_id.json +1 -0
- data/spec/cassettes/Tacokit_Client_Webhooks/_create_webhook/creates_a_webhook.json +1 -0
- data/spec/cassettes/Tacokit_Client_Webhooks/_delete_webhook/deletes_a_webhook.json +1 -0
- data/spec/cassettes/Tacokit_Client_Webhooks/_update_webhook/updates_a_webhook.json +1 -0
- data/spec/cassettes/Tacokit_Client_Webhooks/_webhook/returns_a_webhook_by_short_link.json +1 -0
- data/spec/cassettes/Tacokit_Client_Webhooks/_webhook_field/returns_a_value.json +1 -0
- data/spec/fixtures/taco.png +0 -0
- data/spec/spec_helper.rb +162 -0
- data/spec/tacokit/authorization_spec.rb +47 -0
- data/spec/tacokit/client/actions_spec.rb +100 -0
- data/spec/tacokit/client/boards_spec.rb +168 -0
- data/spec/tacokit/client/cards_spec.rb +192 -0
- data/spec/tacokit/client/checklists_spec.rb +87 -0
- data/spec/tacokit/client/labels_spec.rb +70 -0
- data/spec/tacokit/client/lists_spec.rb +81 -0
- data/spec/tacokit/client/members_spec.rb +114 -0
- data/spec/tacokit/client/notifications_spec.rb +52 -0
- data/spec/tacokit/client/organizations_spec.rb +100 -0
- data/spec/tacokit/client/searches_spec.rb +13 -0
- data/spec/tacokit/client/tokens_spec.rb +49 -0
- data/spec/tacokit/client/types_spec.rb +12 -0
- data/spec/tacokit/client/webhooks_spec.rb +70 -0
- data/spec/tacokit/client_spec.rb +28 -0
- data/spec/tacokit/configuration_spec.rb +51 -0
- data/spec/tacokit/middleware/boom_spec.rb +35 -0
- data/spec/tacokit/resource_spec.rb +26 -0
- data/spec/tacokit/transform_spec.rb +131 -0
- data/spec/tacokit_spec.rb +16 -0
- data/tacokit.gemspec +28 -0
- metadata +436 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f2578b367de9a2fa3604a9942c8605949fbe319a
|
4
|
+
data.tar.gz: c78e9ff1f74434acd490dbe1aacc4eb9dac5c579
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 510e5322ab2146b830db7124c8f644a5e7d2b35fc3a9c2ee2f2f8750690ae23103142d537040118d3329632cc8ff78147b63036a1ab99beafe2ddd06f2eb9c72
|
7
|
+
data.tar.gz: 2487e3e8af3c5f79a54555ce7c8021bc7417f20398bed4a787ab08f1e8f819ac780a0aaacf41ca17f9723c56864381e4533f0510821153ee88a925db41d4067b
|
data/.gitignore
ADDED
data/.pryrc
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
rvm:
|
4
|
+
- 1.9.3
|
5
|
+
- 2.0.0
|
6
|
+
- 2.1
|
7
|
+
- ruby-head
|
8
|
+
|
9
|
+
bundler_args: --without development --retry=3 --jobs=3
|
10
|
+
|
11
|
+
env:
|
12
|
+
# global:
|
13
|
+
# - TRELLO_APP_KEY='tacokit-app-key'
|
14
|
+
|
15
|
+
matrix:
|
16
|
+
allow_failures:
|
17
|
+
- rvm: ruby-head
|
18
|
+
fast_finish: true
|
data/Gemfile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
group :development do
|
6
|
+
gem 'awesome_print', :require => 'ap'
|
7
|
+
gem 'guard-rspec'
|
8
|
+
gem 'pry'
|
9
|
+
gem 'pry-byebug', :platforms => :ruby_21
|
10
|
+
|
11
|
+
gem 'oauth'
|
12
|
+
gem 'sinatra'
|
13
|
+
end
|
14
|
+
|
15
|
+
group :test do
|
16
|
+
# gem 'coveralls', :require => false
|
17
|
+
# gem 'json', '~> 1.7', :platforms => [:ruby_18, :jruby]
|
18
|
+
# gem 'mime-types', '< 2.0.0'
|
19
|
+
# gem 'netrc', '~> 0.7.7'
|
20
|
+
gem 'dotenv'
|
21
|
+
gem 'launchy'
|
22
|
+
gem 'rb-fsevent'
|
23
|
+
gem 'rspec'
|
24
|
+
gem 'simplecov', :require => false
|
25
|
+
gem 'vcr'
|
26
|
+
gem 'webmock'
|
27
|
+
gem 'rake'
|
28
|
+
end
|
data/Guardfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
2
|
+
require "ostruct"
|
3
|
+
|
4
|
+
rspec = OpenStruct.new
|
5
|
+
rspec.spec = ->(m) { "spec/#{m}_spec.rb" }
|
6
|
+
rspec.spec_dir = "spec"
|
7
|
+
rspec.spec_helper = "spec/spec_helper.rb"
|
8
|
+
|
9
|
+
watch(%r{^spec/.+_spec\.rb$})
|
10
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| rspec.spec.(m[1]) }
|
11
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
12
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Ross Kaffenberger
|
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.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
# Tacokit
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/rossta/tacokit.rb.svg?branch=master)](https://travis-ci.org/rossta/tacokit.rb) [![Code Climate](https://codeclimate.com/github/rossta/tacokit.rb/badges/gpa.svg)](https://codeclimate.com/github/rossta/tacokit.rb) [![Dependency Status](https://gemnasium.com/rossta/tacokit.rb.svg)](https://gemnasium.com/rossta/tacokit.rb)
|
4
|
+
|
5
|
+
Ruby toolkit for the Trello API... a work-in-progress. Design and philosophy
|
6
|
+
inspired by [ocktokit.rb](https://github.com/ocktokit/ocktokit.rb)
|
7
|
+
|
8
|
+
This is Taco.
|
9
|
+
|
10
|
+
![Taco][taco]
|
11
|
+
[taco]: http://cl.ly/image/2p1x3K1X160b/taco.png
|
12
|
+
|
13
|
+
## Quick Start
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'tacokit'
|
19
|
+
```
|
20
|
+
|
21
|
+
... or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install tacokit
|
24
|
+
|
25
|
+
Configure the client with public-read application credentials:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
# View an app key and secret on Trello
|
29
|
+
Tacokit.open_app_key
|
30
|
+
|
31
|
+
# Configure the client
|
32
|
+
Tacokit.configure do |c|
|
33
|
+
c.app_key = '4ppk3y'
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
Make requests to Trello API methods using module-level configuration or as
|
38
|
+
client instance methods.
|
39
|
+
```ruby
|
40
|
+
# Fetch the current member
|
41
|
+
Tacokit.member
|
42
|
+
|
43
|
+
# Fetch another member
|
44
|
+
Tacokit.member 'tacokit'
|
45
|
+
|
46
|
+
# Configure a separate client
|
47
|
+
client = Tacokit::Client.new app_key: '4ppk3y'
|
48
|
+
|
49
|
+
# Fetch a member
|
50
|
+
client.member 'tacokit'
|
51
|
+
```
|
52
|
+
## Authentication
|
53
|
+
|
54
|
+
### Application Authorization
|
55
|
+
|
56
|
+
Trello supports application-level client authorization via an application key and application token.
|
57
|
+
|
58
|
+
Tacokit provides a simple way to retrieve your application key:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
# Install the `launchy` gem to load the Trello page automatically
|
62
|
+
Tacokit.open_app_key
|
63
|
+
```
|
64
|
+
Your application key are available by logging into Trello and visiting the [app key](https://trello.com/app-key) page. This page also provides your application secret that can be used to generate OAuth token access (see below).
|
65
|
+
|
66
|
+
The application token, generated separately from the app key, can be associated with a `scope` and `expiration`. See the Trello [authorization docs](https://trello.com/docs/gettingstarted/authorize.html) for more info on token params.
|
67
|
+
|
68
|
+
Tacokit provides a simple way to generate a new app token:
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
# Full permissions for 30 days
|
72
|
+
Tacokit.authorize scope: %w[ read write account ], expiration: '30days'
|
73
|
+
|
74
|
+
# Authorize a custom application and a different app key
|
75
|
+
Tacokit.authorize name: 'My Trello App', key: '4ppk3y2'
|
76
|
+
|
77
|
+
# Read only permissions for custom app forever
|
78
|
+
Tacokit.authorize scope: 'read', expiration: 'never', name: 'My Trello App'
|
79
|
+
```
|
80
|
+
|
81
|
+
Your Tacokit client can now be configured to make requests:
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
# Configure the client
|
85
|
+
Tacokit.configure do |c|
|
86
|
+
c.app_key = '4ppk3y'
|
87
|
+
c.app_token = '4ppt0k3n'
|
88
|
+
end
|
89
|
+
```
|
90
|
+
|
91
|
+
More information is available in the [Trello docs](https://trello.com/docs/index.html).
|
92
|
+
|
93
|
+
### OAuth Authorization
|
94
|
+
|
95
|
+
The Trello API provides OAuth 1.0 credentials through the typical OAuth web
|
96
|
+
flow. Tacokit clients can therefore be configured separately to make requests on
|
97
|
+
behalf of different members:
|
98
|
+
|
99
|
+
```ruby
|
100
|
+
client = Tacokit::Client.new app_key: '4ppk3y', oauth_token: '04utht0k3n'
|
101
|
+
```
|
102
|
+
|
103
|
+
To experiment with OAuth tokens for development, visit the [Tacokit
|
104
|
+
Sandbox](https://tacokit.herokuapp.com) and enter your Trello app key and app secret.
|
105
|
+
|
106
|
+
#### Resources
|
107
|
+
|
108
|
+
For more information on setting up Trello OAuth for your web application
|
109
|
+
|
110
|
+
* Using OmniAuth? Try adding [omniauth-trello](https://github.com/joshrowley/omniauth-trello)
|
111
|
+
* To roll your own, see how the sandbox works: [Tacokit sandbox source](https://github.com/rossta/tacokit.rb/blob/heroku/app.rb)
|
112
|
+
* Check out the [Trello OAuth docs](https://trello.com/docs/gettingstarted/oauth.html)
|
113
|
+
|
114
|
+
### Using ENV variables
|
115
|
+
|
116
|
+
Default Tacokit client values can be set by values in ENV:
|
117
|
+
|
118
|
+
```shell
|
119
|
+
TRELLO_APP_KEY=4ppk3y
|
120
|
+
TRELLO_APP_SECRET=4pps3cr3t
|
121
|
+
TRELLO_APP_TOKEN=4ppt0k3n
|
122
|
+
```
|
123
|
+
|
124
|
+
## Usage
|
125
|
+
|
126
|
+
Coming soon.
|
127
|
+
|
128
|
+
## Contributing
|
129
|
+
|
130
|
+
1. Fork it ( https://github.com/[my-github-username]/tacokit/fork )
|
131
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
132
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
133
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
134
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/config.ru
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
module Tacokit
|
2
|
+
module Authorization
|
3
|
+
|
4
|
+
def open_app_key
|
5
|
+
open_url web_url("appKey/generate")
|
6
|
+
end
|
7
|
+
|
8
|
+
# Params
|
9
|
+
# callback_method: "postMessage" or "fragment"
|
10
|
+
# return_url: URL the token should be returned to
|
11
|
+
# scope: Comma-separated list of one or more of "read", "write", "account"
|
12
|
+
# expiration: "1hour", "1day", "30days", "never"
|
13
|
+
# name: Name of the application
|
14
|
+
# key: Application key
|
15
|
+
#
|
16
|
+
def authorize(params = {})
|
17
|
+
open_url authorize_url(params)
|
18
|
+
end
|
19
|
+
|
20
|
+
def authorize_url(params = {})
|
21
|
+
params[:key] ||= app_key
|
22
|
+
params[:name] ||= 'Tacokit'
|
23
|
+
params[:response_type] ||= 'token'
|
24
|
+
web_url "authorize", params
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def open_url(url)
|
30
|
+
require 'launchy'
|
31
|
+
Launchy.open(url)
|
32
|
+
rescue LoadError
|
33
|
+
warn "Visit #{url}"
|
34
|
+
warn "Please install the launchy gem to open the url automatically."
|
35
|
+
end
|
36
|
+
|
37
|
+
def web_url(path, params = {})
|
38
|
+
web_connection.build_url(path, params).to_s
|
39
|
+
end
|
40
|
+
|
41
|
+
def web_connection
|
42
|
+
Faraday::Connection.new(web_endpoint)
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Tacokit
|
2
|
+
class Client
|
3
|
+
module Actions
|
4
|
+
|
5
|
+
# GET /1/actions/[idAction]
|
6
|
+
def action(action_id, options = nil)
|
7
|
+
get action_path(action_id), options
|
8
|
+
end
|
9
|
+
|
10
|
+
# GET /1/actions/[idAction]/[field]
|
11
|
+
def action_field(action_id, field)
|
12
|
+
get action_path(action_id, camp(field))
|
13
|
+
end
|
14
|
+
|
15
|
+
# GET /1/actions/[idAction]/[resource]
|
16
|
+
# board
|
17
|
+
# board/[field]
|
18
|
+
# card
|
19
|
+
# card/[field]
|
20
|
+
# entities
|
21
|
+
# list
|
22
|
+
# list/[field]
|
23
|
+
# member
|
24
|
+
# member/[field]
|
25
|
+
# memberCreator
|
26
|
+
# memberCreator/[field]
|
27
|
+
# organization
|
28
|
+
# organization/[field]
|
29
|
+
def action_resource(action_id, resource, *paths)
|
30
|
+
paths, options = extract_options(camp(resource), *paths)
|
31
|
+
get action_path(action_id, *paths), options
|
32
|
+
end
|
33
|
+
|
34
|
+
# PUT /1/actions/[idAction]
|
35
|
+
def update_action(action_id, options = {})
|
36
|
+
put action_path(action_id), options
|
37
|
+
end
|
38
|
+
|
39
|
+
# PUT /1/actions/[idAction]/text
|
40
|
+
def update_action_text(action_id, text)
|
41
|
+
put action_path(action_id, 'text'), value: text
|
42
|
+
end
|
43
|
+
|
44
|
+
# DELETE /1/actions/[idAction]
|
45
|
+
def delete_action(action_id)
|
46
|
+
delete action_path(action_id)
|
47
|
+
end
|
48
|
+
|
49
|
+
def action_path(*paths)
|
50
|
+
path_join("actions", *paths)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
module Tacokit
|
2
|
+
class Client
|
3
|
+
module Boards
|
4
|
+
|
5
|
+
# GET /1/boards/[board_id]
|
6
|
+
def board(board_id, options = nil)
|
7
|
+
get board_path(board_id), options
|
8
|
+
end
|
9
|
+
|
10
|
+
# GET /1/boards/[board_id]/[field]
|
11
|
+
def board_field(board_id, field, options = nil)
|
12
|
+
get board_path(board_id, camp(field)), options
|
13
|
+
end
|
14
|
+
|
15
|
+
# GET /1/boards/[board_id]/[resource]
|
16
|
+
# actions
|
17
|
+
# boardStars
|
18
|
+
# cards
|
19
|
+
# cards/[filter]
|
20
|
+
# cards/[idCard]
|
21
|
+
# checklists
|
22
|
+
# deltas
|
23
|
+
# labels
|
24
|
+
# labels/[idLabel]
|
25
|
+
# lists
|
26
|
+
# lists/[filter]
|
27
|
+
# members
|
28
|
+
# members/[filter]
|
29
|
+
# members/[idMember]/cards
|
30
|
+
# membersInvited
|
31
|
+
# membersInvited/[field]
|
32
|
+
# memberships
|
33
|
+
# memberships/[idMembership]
|
34
|
+
# myPrefs
|
35
|
+
# organization
|
36
|
+
# organization/[field]
|
37
|
+
def board_resource(board_id, resource, *paths)
|
38
|
+
paths, options = extract_options(camp(resource), *paths)
|
39
|
+
get board_path(board_id, *paths), options
|
40
|
+
end
|
41
|
+
|
42
|
+
# PUT /1/boards/[board_id]
|
43
|
+
def update_board(board_id, options = {})
|
44
|
+
put board_path(board_id), options
|
45
|
+
end
|
46
|
+
|
47
|
+
# PUT /1/boards/[board_id]/[field]
|
48
|
+
# closed
|
49
|
+
# desc
|
50
|
+
# idOrganization
|
51
|
+
# labelNames/blue
|
52
|
+
# labelNames/green
|
53
|
+
# labelNames/orange
|
54
|
+
# labelNames/purple
|
55
|
+
# labelNames/red
|
56
|
+
# labelNames/yellow
|
57
|
+
# myPrefs/emailPosition
|
58
|
+
# myPrefs/idEmailList
|
59
|
+
# myPrefs/showListGuide
|
60
|
+
# myPrefs/showSidebar
|
61
|
+
# myPrefs/showSidebarActivity
|
62
|
+
# myPrefs/showSidebarBoardActions
|
63
|
+
# myPrefs/showSidebarMembers
|
64
|
+
# name
|
65
|
+
# prefs/background
|
66
|
+
# prefs/calendarFeedEnabled
|
67
|
+
# prefs/cardAging
|
68
|
+
# prefs/cardCovers
|
69
|
+
# prefs/comments
|
70
|
+
# prefs/invitations
|
71
|
+
# prefs/permissionLevel
|
72
|
+
# prefs/selfJoin
|
73
|
+
# prefs/voting
|
74
|
+
# subscribed
|
75
|
+
def update_board_field(board_id, *paths)
|
76
|
+
value = paths.pop
|
77
|
+
put board_path(board_id, camel_join(*paths)), value: value
|
78
|
+
end
|
79
|
+
|
80
|
+
# PUT /1/boards/[board_id]/members
|
81
|
+
def add_board_member(board_id, email, full_name, options = {})
|
82
|
+
options.update \
|
83
|
+
email: email,
|
84
|
+
full_name: full_name
|
85
|
+
put board_path(board_id, "members"), options
|
86
|
+
end
|
87
|
+
|
88
|
+
# PUT /1/boards/[board_id]/[resource]
|
89
|
+
# members/[idMember]
|
90
|
+
# memberships/[idMembership]
|
91
|
+
def update_board_resource(board_id, resource, resource_id, options = {})
|
92
|
+
put board_path(board_id, camp(resource), resource_id), options
|
93
|
+
end
|
94
|
+
|
95
|
+
# POST /1/boards
|
96
|
+
def create_board(name, options = {})
|
97
|
+
post board_path, options.merge(name: name)
|
98
|
+
end
|
99
|
+
|
100
|
+
# POST /1/boards/[board_id]/[resource]
|
101
|
+
# calendarKey/generate
|
102
|
+
# checklists
|
103
|
+
# emailKey/generate
|
104
|
+
# labels
|
105
|
+
# lists
|
106
|
+
# markAsViewed
|
107
|
+
# powerUps
|
108
|
+
def create_board_resource(board_id, resource, *paths)
|
109
|
+
paths, options = extract_options(camp(resource), *paths)
|
110
|
+
post board_path(board_id, *paths), options
|
111
|
+
end
|
112
|
+
|
113
|
+
# DELETE /1/boards/[board_id]/[resource]/[resource_id]
|
114
|
+
# members/[idMember]
|
115
|
+
# powerUps/[powerUp]
|
116
|
+
#
|
117
|
+
|
118
|
+
def board_path(*paths)
|
119
|
+
path_join("boards", *paths)
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
@@ -0,0 +1,143 @@
|
|
1
|
+
module Tacokit
|
2
|
+
class Client
|
3
|
+
module Cards
|
4
|
+
|
5
|
+
# GET cards/[card id or shortlink]
|
6
|
+
def card(card_id, options = nil)
|
7
|
+
get card_path(card_id), options
|
8
|
+
end
|
9
|
+
|
10
|
+
# GET cards/[card id or shortlink]/[field]
|
11
|
+
# badges
|
12
|
+
# checkItemStates
|
13
|
+
# closed
|
14
|
+
# dateLastActivity
|
15
|
+
# desc
|
16
|
+
# descData
|
17
|
+
# due
|
18
|
+
# email
|
19
|
+
# idAttachmentCover
|
20
|
+
# idBoard
|
21
|
+
# idChecklists
|
22
|
+
# idLabels
|
23
|
+
# idList
|
24
|
+
# idMembers
|
25
|
+
# idMembersVoted
|
26
|
+
# idShort
|
27
|
+
# labels
|
28
|
+
# manualCoverAttachment
|
29
|
+
# name
|
30
|
+
# pos
|
31
|
+
# shortLink
|
32
|
+
# shortUrl
|
33
|
+
# subscribed
|
34
|
+
# url
|
35
|
+
def card_field(card_id, field, options = nil)
|
36
|
+
get card_path(card_id, camp(field)), options
|
37
|
+
end
|
38
|
+
|
39
|
+
# GET cards/[card id or shortlink]/[resource]
|
40
|
+
# actions
|
41
|
+
# attachments
|
42
|
+
# attachments/[idAttachment]
|
43
|
+
# board
|
44
|
+
# board/[field]
|
45
|
+
# checkItemStates
|
46
|
+
# checklists
|
47
|
+
# list
|
48
|
+
# list/[field]
|
49
|
+
# members
|
50
|
+
# membersVoted
|
51
|
+
# stickers
|
52
|
+
# stickers/[idSticker]
|
53
|
+
def card_resource(card_id, resource, options = {})
|
54
|
+
get card_path(card_id, camp(resource)), options
|
55
|
+
end
|
56
|
+
|
57
|
+
# PUT cards/[card id or shortlink]
|
58
|
+
def update_card(card_id, options = {})
|
59
|
+
put card_path(card_id), options
|
60
|
+
end
|
61
|
+
|
62
|
+
# PUT cards/[card id or shortlink]/[resource]
|
63
|
+
# actions/[idAction]/comments
|
64
|
+
# checklist/[idChecklist]/checkItem/[idCheckItem]/name
|
65
|
+
# checklist/[idChecklist]/checkItem/[idCheckItem]/pos
|
66
|
+
# checklist/[idChecklist]/checkItem/[idCheckItem]/state
|
67
|
+
# checklist/[idChecklistCurrent]/checkItem/[idCheckItem]
|
68
|
+
# closed
|
69
|
+
# desc
|
70
|
+
# due
|
71
|
+
# idAttachmentCover
|
72
|
+
# idBoard
|
73
|
+
# idList
|
74
|
+
# idMembers
|
75
|
+
# labels
|
76
|
+
# name
|
77
|
+
# pos
|
78
|
+
# stickers/[idSticker]
|
79
|
+
# subscribed
|
80
|
+
|
81
|
+
# POST cards
|
82
|
+
def create_card(list_id, name = nil, options = {})
|
83
|
+
post card_path, options.merge(name: name, list_id: list_id)
|
84
|
+
end
|
85
|
+
|
86
|
+
# POST cards/[card id or shortlink]/actions/comments
|
87
|
+
def create_card_comment(card_id, text, options = {})
|
88
|
+
options.update text: text
|
89
|
+
create_card_resource card_id, "actions", "comments", options
|
90
|
+
end
|
91
|
+
|
92
|
+
# POST cards/[card id or shortlink]/attachments
|
93
|
+
def create_card_attachment(card_id, url, mime_type = nil, options = {})
|
94
|
+
uri = Addressable::URI.parse(url)
|
95
|
+
|
96
|
+
if uri.scheme =~ %r{https?}
|
97
|
+
options.update url: uri.to_s, mime_type: mime_type
|
98
|
+
else
|
99
|
+
file = Faraday::UploadIO.new(uri.to_s, mime_type)
|
100
|
+
options.update file: file, mime_type: file.content_type
|
101
|
+
end
|
102
|
+
|
103
|
+
create_card_resource card_id, 'attachments', options
|
104
|
+
end
|
105
|
+
|
106
|
+
# POST cards/[card id or shortlink]/[resource]
|
107
|
+
# checklist/[idChecklist]/checkItem
|
108
|
+
# checklist/[idChecklist]/checkItem/[idCheckItem]/convertToCard
|
109
|
+
# checklists
|
110
|
+
# idMembers
|
111
|
+
# labels
|
112
|
+
# markAssociatedNotificationsRead
|
113
|
+
# membersVoted
|
114
|
+
# stickers
|
115
|
+
def create_card_resource(card_id, resource, *paths)
|
116
|
+
paths, options = extract_options(camp(resource), *paths)
|
117
|
+
post card_path(card_id, *paths), options
|
118
|
+
end
|
119
|
+
|
120
|
+
# DELETE cards/[card id or shortlink]
|
121
|
+
def delete_card(card_id)
|
122
|
+
delete card_path(card_id)
|
123
|
+
end
|
124
|
+
|
125
|
+
# DELETE cards/[card id or shortlink]/[resource]
|
126
|
+
# actions/[idAction]/comments
|
127
|
+
# attachments/[idAttachment]
|
128
|
+
# checklist/[idChecklist]/checkItem/[idCheckItem]
|
129
|
+
# checklists/[idChecklist]
|
130
|
+
# idMembers/[idMember]
|
131
|
+
# labels/[color]
|
132
|
+
# membersVoted/[idMember]
|
133
|
+
# stickers/[idSticker]
|
134
|
+
def delete_card_resource(card_id, resource, *paths)
|
135
|
+
delete card_path(card_id, camp(resource), *paths)
|
136
|
+
end
|
137
|
+
|
138
|
+
def card_path(*paths)
|
139
|
+
path_join "cards", *paths
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|