tacokit 0.1.0 → 0.2.0
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +86 -0
- data/.travis.yml +6 -0
- data/Gemfile +16 -25
- data/Guardfile +1 -1
- data/README.md +61 -17
- data/Rakefile +10 -5
- data/lib/tacokit/authorization.rb +14 -13
- data/lib/tacokit/client/actions.rb +68 -28
- data/lib/tacokit/client/boards.rb +92 -85
- data/lib/tacokit/client/cards.rb +285 -92
- data/lib/tacokit/client/checklists.rb +48 -28
- data/lib/tacokit/client/labels.rb +14 -16
- data/lib/tacokit/client/lists.rb +52 -28
- data/lib/tacokit/client/members.rb +56 -46
- data/lib/tacokit/client/notifications.rb +13 -27
- data/lib/tacokit/client/organizations.rb +0 -6
- data/lib/tacokit/client/searches.rb +0 -1
- data/lib/tacokit/client/tokens.rb +0 -6
- data/lib/tacokit/client/types.rb +0 -1
- data/lib/tacokit/client/webhooks.rb +3 -8
- data/lib/tacokit/client.rb +48 -75
- data/lib/tacokit/collection.rb +49 -0
- data/lib/tacokit/configuration.rb +4 -6
- data/lib/tacokit/error.rb +0 -2
- data/lib/tacokit/middleware/boom.rb +6 -7
- data/lib/tacokit/middleware.rb +2 -10
- data/lib/tacokit/resource.rb +84 -57
- data/lib/tacokit/response.rb +3 -3
- data/lib/tacokit/transform.rb +35 -13
- data/lib/tacokit/utils.rb +40 -8
- data/lib/tacokit/version.rb +1 -1
- data/lib/tacokit.rb +0 -2
- data/spec/cassettes/Tacokit_Client_Actions/_action_board/returns_action_board.json +1 -0
- data/spec/cassettes/Tacokit_Client_Actions/_action_card/returns_action_card.json +1 -0
- data/spec/cassettes/Tacokit_Client_Actions/_action_entities/returns_action_entities.json +1 -0
- data/spec/cassettes/Tacokit_Client_Actions/_action_list/returns_action_list.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_add_board_member/adds_invites_member_to_board.json +1 -1
- data/spec/cassettes/Tacokit_Client_Boards/_board_actions/returns_board_actions.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_board_cards/returns_board_cards.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_board_checklists/returns_board_checklists.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_board_labels/returns_board_labels.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_board_lists/returns_board_lists.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_board_members/returns_board_members.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_board_organization/returns_board_organization.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_board_preferences/returns_preferences_for_a_board.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_board_stars/returns_board_stars.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_member_board_stars/returns_board_stars.json +1 -0
- data/spec/cassettes/Tacokit_Client_Boards/_update_board_member/updates_member.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_add_comment/creates_a_comment.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_add_label/adds_label_to_card.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_add_member_to_card/adds_member_to_card.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_archive_card/archives_card.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_archive_card/restore_card.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_attachments/returns_an_attachment.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_attachments/returns_attachment.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_attachments/returns_attachments.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_card/returns_a_card_by_card_resource.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_card/returns_a_card_by_id.json +1 -1
- data/spec/cassettes/Tacokit_Client_Cards/_card/returns_a_card_by_short_link.json +1 -1
- data/spec/cassettes/Tacokit_Client_Cards/_card_actions/returns_card_actions.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_card_board/returns_card_board.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_card_field/returns_a_hash.json +1 -1
- data/spec/cassettes/Tacokit_Client_Cards/_card_field/returns_a_value.json +1 -1
- data/spec/cassettes/Tacokit_Client_Cards/_card_field/returns_an_array.json +1 -1
- data/spec/cassettes/Tacokit_Client_Cards/_card_list/returns_a_list.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_card_members/returns_members.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_card_members/returns_members_voted.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_card_resource/returns_card_actions.json +1 -1
- data/spec/cassettes/Tacokit_Client_Cards/_card_resource/returns_card_board.json +1 -1
- data/spec/cassettes/Tacokit_Client_Cards/_card_resource/returns_card_check_item_states.json +1 -1
- data/spec/cassettes/Tacokit_Client_Cards/_card_stickers/returns_.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_checklists/returns_check_item_states.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_checklists/returns_checklists.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_create_card/creates_a_card.json +1 -1
- data/spec/cassettes/Tacokit_Client_Cards/_create_card_attachment/attaches_external_url.json +1 -1
- data/spec/cassettes/Tacokit_Client_Cards/_create_card_attachment/uploads_local_file.json +1 -1
- data/spec/cassettes/Tacokit_Client_Cards/_delete_card/deletes_a_card.json +1 -1
- data/spec/cassettes/Tacokit_Client_Cards/_delete_card_resource/deletes_resource.json +1 -1
- data/spec/cassettes/Tacokit_Client_Cards/_delete_comment/deletes_comment.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_list/returns_list.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_move_card/moves_card_to_a_new_position.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_move_card/moves_card_to_another_board_list.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_move_card/moves_card_to_board.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_move_card/moves_card_to_list.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_move_card/raises_error_if_missing_options.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_start_checklist/adds_a_checklist_item.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_start_checklist/adds_new_checklist_by_name.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_start_checklist/copies_a_checklist_by_id.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_stickers/returns_stickers.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_update_card/updates_a_card.json +1 -1
- data/spec/cassettes/Tacokit_Client_Cards/_update_checklist_item/updates_checklist_item.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_update_comment/updates_a_comment.json +1 -0
- data/spec/cassettes/Tacokit_Client_Cards/_vote/adds_a_member_s_vote_to_card.json +1 -0
- data/spec/cassettes/Tacokit_Client_Checklists/_check_items/adds_a_checklist_check_item.json +1 -0
- data/spec/cassettes/Tacokit_Client_Checklists/_check_items/retrieves_checklist_check_items.json +1 -0
- data/spec/cassettes/Tacokit_Client_Lists/_archive_list_cards/should_archive_cards_in_list.json +1 -0
- data/spec/cassettes/Tacokit_Client_Lists/_list_actions/returns_list_actions.json +1 -0
- data/spec/cassettes/Tacokit_Client_Lists/_list_board/returns_list_board.json +1 -0
- data/spec/cassettes/Tacokit_Client_Lists/_list_cards/returns_list_cards.json +1 -0
- data/spec/cassettes/Tacokit_Client_Lists/_move_list_cards/should_move_cards_in_list.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_actions/returns_member_actions.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_board_stars/returns_member_board_stars.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_boards/returns_member_boards.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_cards/returns_member_cards.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_notifications/returns_member_notifications.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_organizations/returns_member_organizations.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_tokens/returns_member_organizations.json +1 -0
- data/spec/cassettes/Tacokit_Client_Members/_tokens/returns_member_tokens.json +1 -0
- data/spec/spec_helper.rb +39 -29
- data/spec/tacokit/authorization_spec.rb +11 -11
- data/spec/tacokit/client/actions_spec.rb +56 -19
- data/spec/tacokit/client/boards_spec.rb +81 -78
- data/spec/tacokit/client/cards_spec.rb +322 -68
- data/spec/tacokit/client/checklists_spec.rb +29 -27
- data/spec/tacokit/client/labels_spec.rb +8 -16
- data/spec/tacokit/client/lists_spec.rb +74 -27
- data/spec/tacokit/client/members_spec.rb +55 -41
- data/spec/tacokit/client/notifications_spec.rb +3 -31
- data/spec/tacokit/client/organizations_spec.rb +6 -27
- data/spec/tacokit/client/searches_spec.rb +1 -3
- data/spec/tacokit/client/tokens_spec.rb +2 -18
- data/spec/tacokit/client/types_spec.rb +2 -3
- data/spec/tacokit/client/webhooks_spec.rb +6 -14
- data/spec/tacokit/client_spec.rb +3 -3
- data/spec/tacokit/configuration_spec.rb +30 -31
- data/spec/tacokit/middleware/boom_spec.rb +6 -7
- data/spec/tacokit/resource_spec.rb +142 -17
- data/spec/tacokit/transform_spec.rb +37 -35
- data/spec/tacokit_spec.rb +3 -5
- data/tacokit.gemspec +6 -6
- metadata +132 -15
- data/config.ru +0 -7
- data/lib/tacokit/middleware/debug.rb +0 -22
- data/spec/cassettes/Tacokit_Client_Boards/_update_board_resource/updates_member.json +0 -1
- data/spec/cassettes/Tacokit_Client_Members/_member/raises_error_for_missing_token.json +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14ef84fc424d2cad14b4ea5ff37a270d9e3b5399
|
4
|
+
data.tar.gz: 130dd7e3aa458418bfb83f945026edb91f272286
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fcc934c4029cabdcbb49827c3598b66daa1774b6e10346f8f5cb3be8371baf56c5fe685757f5e81e71003674eee75551452c05eefd790dc39a8731105460243
|
7
|
+
data.tar.gz: 2b974070b2c21ef16b3cd0535a9142da22e657a0e459aa08b753fe8881d14ad37c29719919725ed57273822fd2a570a15779cabd89e87511bb02fd502068962e
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- "Guardfile"
|
4
|
+
- "spec/cassettes/**/*"
|
5
|
+
- "vendor/**/*"
|
6
|
+
|
7
|
+
Lint/UnusedBlockArgument:
|
8
|
+
Enabled: false
|
9
|
+
#
|
10
|
+
Lint/UnusedMethodArgument:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
Metrics/LineLength:
|
14
|
+
Max: 150 # TODO: we should decrease this to 120
|
15
|
+
|
16
|
+
Metrics/ClassLength:
|
17
|
+
Max: 300
|
18
|
+
|
19
|
+
Metrics/MethodLength:
|
20
|
+
Max: 25
|
21
|
+
|
22
|
+
Metrics/ParameterLists:
|
23
|
+
Max: 8
|
24
|
+
|
25
|
+
Metrics/AbcSize:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Metrics/CyclomaticComplexity:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Metrics/PerceivedComplexity:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Style/AlignParameters:
|
35
|
+
EnforcedStyle: with_fixed_indentation
|
36
|
+
|
37
|
+
Style/StringLiterals:
|
38
|
+
EnforcedStyle: double_quotes
|
39
|
+
|
40
|
+
Style/StringLiteralsInInterpolation:
|
41
|
+
EnforcedStyle: double_quotes
|
42
|
+
|
43
|
+
Style/AndOr:
|
44
|
+
Enabled: false
|
45
|
+
|
46
|
+
Style/Not:
|
47
|
+
Enabled: false
|
48
|
+
|
49
|
+
Style/DoubleNegation:
|
50
|
+
Enabled: false
|
51
|
+
|
52
|
+
Documentation:
|
53
|
+
Enabled: false # TODO: Enable again once we have more docs
|
54
|
+
|
55
|
+
Style/CaseIndentation:
|
56
|
+
IndentWhenRelativeTo: case
|
57
|
+
SupportedStyles:
|
58
|
+
- case
|
59
|
+
- end
|
60
|
+
IndentOneStep: false
|
61
|
+
|
62
|
+
Style/PercentLiteralDelimiters:
|
63
|
+
PreferredDelimiters:
|
64
|
+
"%w": "[]"
|
65
|
+
"%W": "[]"
|
66
|
+
|
67
|
+
Style/AccessModifierIndentation:
|
68
|
+
EnforcedStyle: indent
|
69
|
+
|
70
|
+
Style/RegexpLiteral:
|
71
|
+
Enabled: false
|
72
|
+
|
73
|
+
Style/SignalException:
|
74
|
+
Enabled: false
|
75
|
+
|
76
|
+
Style/IndentationWidth:
|
77
|
+
Enabled: false
|
78
|
+
|
79
|
+
Lint/EndAlignment:
|
80
|
+
AlignWith: variable
|
81
|
+
|
82
|
+
Lint/DefEndAlignment:
|
83
|
+
Enabled: false
|
84
|
+
|
85
|
+
Lint/HandleExceptions:
|
86
|
+
Enabled: false
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,28 +1,19 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
5
|
+
gem "awesome_print", require: "ap"
|
6
|
+
gem "coveralls", require: false
|
7
|
+
gem "dotenv"
|
8
|
+
gem "guard-rspec"
|
9
|
+
gem "launchy"
|
10
|
+
gem "oauth"
|
11
|
+
gem "pry"
|
12
|
+
gem "pry-byebug", platforms: :ruby_21
|
13
|
+
gem "rake"
|
14
|
+
gem "rb-fsevent"
|
15
|
+
gem "rspec"
|
16
|
+
gem "rubocop"
|
17
|
+
gem "sinatra"
|
18
|
+
gem "vcr"
|
19
|
+
gem "webmock"
|
data/Guardfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Tacokit
|
2
2
|
|
3
|
-
[](https://travis-ci.org/rossta/tacokit.rb) [](https://codeclimate.com/github/rossta/tacokit.rb) [](https://gemnasium.com/rossta/tacokit.rb)
|
3
|
+
[](https://travis-ci.org/rossta/tacokit.rb) [](https://codeclimate.com/github/rossta/tacokit.rb) [](https://gemnasium.com/rossta/tacokit.rb) [](https://coveralls.io/r/rossta/tacokit.rb)
|
4
4
|
|
5
5
|
Ruby toolkit for the Trello API... a work-in-progress. Design and philosophy
|
6
6
|
inspired by [ocktokit.rb](https://github.com/ocktokit/ocktokit.rb)
|
@@ -12,10 +12,10 @@ This is Taco.
|
|
12
12
|
|
13
13
|
## Quick Start
|
14
14
|
|
15
|
-
Add this line to your application
|
15
|
+
Add this line to your application"s Gemfile:
|
16
16
|
|
17
17
|
```ruby
|
18
|
-
gem
|
18
|
+
gem "tacokit"
|
19
19
|
```
|
20
20
|
|
21
21
|
... or install it yourself as:
|
@@ -26,11 +26,11 @@ Configure the client with public-read application credentials:
|
|
26
26
|
|
27
27
|
```ruby
|
28
28
|
# View an app key and secret on Trello
|
29
|
-
Tacokit.
|
29
|
+
Tacokit.get_app_key
|
30
30
|
|
31
31
|
# Configure the client
|
32
32
|
Tacokit.configure do |c|
|
33
|
-
c.app_key =
|
33
|
+
c.app_key = "4ppk3y"
|
34
34
|
end
|
35
35
|
```
|
36
36
|
|
@@ -41,13 +41,13 @@ client instance methods.
|
|
41
41
|
Tacokit.member
|
42
42
|
|
43
43
|
# Fetch another member
|
44
|
-
Tacokit.member
|
44
|
+
Tacokit.member "tacokit"
|
45
45
|
|
46
46
|
# Configure a separate client
|
47
|
-
client = Tacokit::Client.new app_key:
|
47
|
+
client = Tacokit::Client.new app_key: "4ppk3y"
|
48
48
|
|
49
49
|
# Fetch a member
|
50
|
-
client.member
|
50
|
+
client.member "tacokit"
|
51
51
|
```
|
52
52
|
## Authentication
|
53
53
|
|
@@ -59,7 +59,7 @@ Tacokit provides a simple way to retrieve your application key:
|
|
59
59
|
|
60
60
|
```ruby
|
61
61
|
# Install the `launchy` gem to load the Trello page automatically
|
62
|
-
Tacokit.
|
62
|
+
Tacokit.get_app_key
|
63
63
|
```
|
64
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
65
|
|
@@ -69,13 +69,13 @@ Tacokit provides a simple way to generate a new app token:
|
|
69
69
|
|
70
70
|
```ruby
|
71
71
|
# Full permissions for 30 days
|
72
|
-
Tacokit.authorize scope: %w[ read write account ], expiration:
|
72
|
+
Tacokit.authorize scope: %w[ read write account ], expiration: "30days"
|
73
73
|
|
74
74
|
# Authorize a custom application and a different app key
|
75
|
-
Tacokit.authorize name:
|
75
|
+
Tacokit.authorize name: "My Trello App", key: "4ppk3y2"
|
76
76
|
|
77
77
|
# Read only permissions for custom app forever
|
78
|
-
Tacokit.authorize scope:
|
78
|
+
Tacokit.authorize scope: "read", expiration: "never", name: "My Trello App"
|
79
79
|
```
|
80
80
|
|
81
81
|
Your Tacokit client can now be configured to make requests:
|
@@ -83,8 +83,8 @@ Your Tacokit client can now be configured to make requests:
|
|
83
83
|
```ruby
|
84
84
|
# Configure the client
|
85
85
|
Tacokit.configure do |c|
|
86
|
-
c.app_key =
|
87
|
-
c.app_token =
|
86
|
+
c.app_key = "4ppk3y"
|
87
|
+
c.app_token = "4ppt0k3n"
|
88
88
|
end
|
89
89
|
```
|
90
90
|
|
@@ -97,7 +97,7 @@ flow. Tacokit clients can therefore be configured separately to make requests on
|
|
97
97
|
behalf of different members:
|
98
98
|
|
99
99
|
```ruby
|
100
|
-
client = Tacokit::Client.new app_key:
|
100
|
+
client = Tacokit::Client.new app_key: "4ppk3y", oauth_token: "04utht0k3n"
|
101
101
|
```
|
102
102
|
|
103
103
|
To experiment with OAuth tokens for development, visit the [Tacokit
|
@@ -123,12 +123,56 @@ TRELLO_APP_TOKEN=4ppt0k3n
|
|
123
123
|
|
124
124
|
## Usage
|
125
125
|
|
126
|
-
|
126
|
+
Working with boards
|
127
|
+
|
128
|
+
```ruby
|
129
|
+
client.boards
|
130
|
+
|
131
|
+
client.boards("rossta")
|
132
|
+
|
133
|
+
board_id = "swezQ9XS" # short link to "Test Board" for Tacokit
|
134
|
+
|
135
|
+
board = client.board(board_id)
|
136
|
+
|
137
|
+
board.name = "Ice Box"
|
138
|
+
|
139
|
+
client.update_board(board.id, name: "TODO")
|
140
|
+
```
|
141
|
+
|
142
|
+
Working with cards
|
143
|
+
|
144
|
+
```ruby
|
145
|
+
client.cards
|
146
|
+
|
147
|
+
client.cards("rossta")
|
148
|
+
|
149
|
+
client.board_cards(board_id)
|
150
|
+
|
151
|
+
card_id = "SpbauOpX" # short link to card on "Test Board"
|
152
|
+
|
153
|
+
card.name = "Shopping List"
|
154
|
+
|
155
|
+
client.update_card(card.id, name: "Wish List")
|
156
|
+
|
157
|
+
client.move_card(card.id, list_id: list_id)
|
158
|
+
```
|
159
|
+
|
160
|
+
Working with lists
|
161
|
+
|
162
|
+
```ruby
|
163
|
+
client.lists(board_id)
|
164
|
+
|
165
|
+
list = client.list(list_id)
|
166
|
+
|
167
|
+
list.name = "Work in Progress"
|
168
|
+
|
169
|
+
client.update_list(list.id, name: "Done")
|
170
|
+
```
|
127
171
|
|
128
172
|
## Contributing
|
129
173
|
|
130
174
|
1. Fork it ( https://github.com/[my-github-username]/tacokit/fork )
|
131
175
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
132
|
-
3. Commit your changes (`git commit -am
|
176
|
+
3. Commit your changes (`git commit -am "Add some feature"`)
|
133
177
|
4. Push to the branch (`git push origin my-new-feature`)
|
134
178
|
5. Create a new Pull Request
|
data/Rakefile
CHANGED
@@ -1,8 +1,13 @@
|
|
1
|
-
require
|
1
|
+
require "bundler"
|
2
2
|
Bundler::GemHelper.install_tasks
|
3
3
|
|
4
|
-
require
|
5
|
-
RSpec::Core::RakeTask.new(:spec)
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
6
|
+
t.rspec_opts = "--color --format progress"
|
7
|
+
end
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
+
require "rubocop/rake_task"
|
10
|
+
RuboCop::RakeTask.new
|
11
|
+
|
12
|
+
task test: [:spec, :rubocop]
|
13
|
+
task default: [:spec, :rubocop]
|
@@ -1,33 +1,35 @@
|
|
1
1
|
module Tacokit
|
2
2
|
module Authorization
|
3
|
-
|
4
|
-
def open_app_key
|
3
|
+
def get_app_key # rubocop:disable Style/AccessorMethodName
|
5
4
|
open_url web_url("appKey/generate")
|
6
5
|
end
|
7
6
|
|
8
|
-
#
|
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
|
7
|
+
# Get a token for making authorized requests to the Trello API
|
15
8
|
#
|
9
|
+
# @param [String, #read] contents the contents to reverse
|
10
|
+
# @param options [Hash] Repository information to update
|
11
|
+
# @option options [String] :name Name of the application
|
12
|
+
# @option options [String] :key Application key
|
13
|
+
# @option options [String] :callback_method "postMessage" or "fragment"
|
14
|
+
# @option options [String] :return_url URL the token should be returned to
|
15
|
+
# @option options [String] :scope Comma-separated list of one or more of "read", "write", "account"
|
16
|
+
# @option options [String] :expiration "1hour", "1day", "30days", "never"
|
17
|
+
# @see https://trello.com/docs/gettingstarted/authorize.html
|
16
18
|
def authorize(params = {})
|
17
19
|
open_url authorize_url(params)
|
18
20
|
end
|
19
21
|
|
20
22
|
def authorize_url(params = {})
|
21
23
|
params[:key] ||= app_key
|
22
|
-
params[:name] ||=
|
23
|
-
params[:response_type] ||=
|
24
|
+
params[:name] ||= "Tacokit"
|
25
|
+
params[:response_type] ||= "token"
|
24
26
|
web_url "authorize", params
|
25
27
|
end
|
26
28
|
|
27
29
|
private
|
28
30
|
|
29
31
|
def open_url(url)
|
30
|
-
require
|
32
|
+
require "launchy"
|
31
33
|
Launchy.open(url)
|
32
34
|
rescue LoadError
|
33
35
|
warn "Visit #{url}"
|
@@ -41,6 +43,5 @@ module Tacokit
|
|
41
43
|
def web_connection
|
42
44
|
Faraday::Connection.new(web_endpoint)
|
43
45
|
end
|
44
|
-
|
45
46
|
end
|
46
47
|
end
|
@@ -1,51 +1,91 @@
|
|
1
1
|
module Tacokit
|
2
2
|
class Client
|
3
3
|
module Actions
|
4
|
-
|
5
|
-
#
|
4
|
+
# Retrieve an action
|
5
|
+
#
|
6
|
+
# @see https://trello.com/docs/api/action/index.html#get-1-actions-idaction
|
6
7
|
def action(action_id, options = nil)
|
7
8
|
get action_path(action_id), options
|
8
9
|
end
|
9
10
|
|
10
|
-
#
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
#
|
18
|
-
#
|
19
|
-
# card
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
11
|
+
# Retrieve an action's board
|
12
|
+
#
|
13
|
+
# @see https://trello.com/docs/api/action/index.html#get-1-actions-idaction-field
|
14
|
+
def action_board(action_id, fields = "all")
|
15
|
+
action_resource action_id, "board", fields: fields
|
16
|
+
end
|
17
|
+
|
18
|
+
# Retrieve an actions" card
|
19
|
+
#
|
20
|
+
# @see https://trello.com/docs/api/action/index.html#get-1-actions-idaction-card
|
21
|
+
def action_card(action_id, fields = "all")
|
22
|
+
action_resource action_id, "card", fields: fields
|
23
|
+
end
|
24
|
+
|
25
|
+
# Retrive an action's entities
|
26
|
+
#
|
27
|
+
# @see https://trello.com/docs/api/action/index.html#get-1-actions-idaction-entities
|
28
|
+
def action_entities(action_id)
|
29
|
+
action_resource action_id, "entities"
|
30
|
+
end
|
31
|
+
|
32
|
+
# Retrieve an action's list
|
33
|
+
#
|
34
|
+
# @see https://trello.com/docs/api/action/index.html#get-1-actions-idaction-list
|
35
|
+
def action_list(action_id, fields = "all")
|
36
|
+
action_resource action_id, "list", fields: fields
|
37
|
+
end
|
38
|
+
|
39
|
+
# Retrieve an actions" member
|
40
|
+
#
|
41
|
+
# @see https://trello.com/docs/api/action/index.html#get-1-actions-idaction-member
|
42
|
+
def action_member(action_id, fields = "all")
|
43
|
+
action_resource action_id, "member", fields: fields
|
44
|
+
end
|
45
|
+
|
46
|
+
# Retrieve an action's creator
|
47
|
+
#
|
48
|
+
# @see https://trello.com/docs/api/action/index.html#get-1-actions-idaction-membercreator
|
49
|
+
def action_member_creator(action_id, fields = "all")
|
50
|
+
action_resource action_id, "memberCreator", fields: fields
|
32
51
|
end
|
33
52
|
|
34
|
-
#
|
53
|
+
# Retrieve an action's org
|
54
|
+
#
|
55
|
+
# @see https://trello.com/docs/api/action/index.html#get-1-actions-idaction-organization
|
56
|
+
def action_organization(action_id, fields = "all")
|
57
|
+
action_resource action_id, "organization", fields: fields
|
58
|
+
end
|
59
|
+
|
60
|
+
# Update an action
|
61
|
+
#
|
62
|
+
# @see https://trello.com/docs/api/action/index.html#put-1-actions-idaction
|
35
63
|
def update_action(action_id, options = {})
|
36
64
|
put action_path(action_id), options
|
37
65
|
end
|
38
66
|
|
39
|
-
#
|
67
|
+
# Set new text for an action
|
68
|
+
#
|
69
|
+
# @see https://trello.com/docs/api/action/index.html#put-1-actions-idaction-text
|
40
70
|
def update_action_text(action_id, text)
|
41
|
-
put action_path(action_id,
|
71
|
+
put action_path(action_id, "text"), value: text
|
42
72
|
end
|
73
|
+
alias_method :edit_action_text, :update_action_text
|
43
74
|
|
44
|
-
#
|
75
|
+
# Delete an action
|
76
|
+
#
|
77
|
+
# @see https://trello.com/docs/api/action/index.html#delete-1-actions-idaction
|
45
78
|
def delete_action(action_id)
|
46
79
|
delete action_path(action_id)
|
47
80
|
end
|
48
81
|
|
82
|
+
private
|
83
|
+
|
84
|
+
def action_resource(action_id, resource, *paths)
|
85
|
+
paths, options = extract_options(camp(resource), *paths)
|
86
|
+
get action_path(action_id, *paths), options
|
87
|
+
end
|
88
|
+
|
49
89
|
def action_path(*paths)
|
50
90
|
path_join("actions", *paths)
|
51
91
|
end
|