trello_client_lite 1.1.2 → 2.0.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/README.md +5 -40
- data/VERSION +1 -1
- data/lib/trello/client.rb +31 -10
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c26b527d461296dd8c259a4f9322a9c1c17c9b95bcd43af9d2a67911f1b724f
|
4
|
+
data.tar.gz: 8ed0c05c58aeb710621f93223150ded5b054ba802138422b647f26afb29c9541
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ec3eb2d4c7fb728722af330c73678e3701f7261af61cc3f393462135bde3b505c6b4eafc1a8e690a8592a2ceb5130d8e4cec1ce12f2f41d484d84fdbc0e67a2
|
7
|
+
data.tar.gz: 200c9934aa0654173406654baeaa0cf6c683b196e3dd4f439c1256406f194e8fa23492ce30a894dc8af146f87071f2670663d502bd25b9563cb1048007163462
|
data/README.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# Trello Client
|
2
2
|
|
3
|
-
|
3
|
+

|
4
|
+

|
5
|
+

|
4
6
|
|
7
|
+
A simple gem for interacting with basic endpoints of the Trello RestAPI.
|
5
8
|
<https://rubygems.org/gems/trello_client_lite>
|
6
9
|
|
7
10
|
## Installation
|
@@ -30,45 +33,7 @@ And require it:
|
|
30
33
|
require 'trello_client_lite'
|
31
34
|
```
|
32
35
|
|
33
|
-
|
34
|
-
|
35
|
-
### Client
|
36
|
-
|
37
|
-
For any interaction with the Trello API you'll need to new up a Trello Client.
|
38
|
-
|
39
|
-
```ruby
|
40
|
-
client = Trello::Client.new(
|
41
|
-
key: ENV.fetch('TRELLO_KEY'),
|
42
|
-
token: ENV.fetch('TRELLO_TOKEN')
|
43
|
-
)
|
44
|
-
```
|
45
|
-
|
46
|
-
### Get Board by Name
|
47
|
-
|
48
|
-
To get a board by name, use the client and pass in the name of the board you
|
49
|
-
want to return.
|
50
|
-
|
51
|
-
```ruby
|
52
|
-
client.get_board_by_name(name: 'My Trello Board')
|
53
|
-
```
|
54
|
-
|
55
|
-
### Get List for Board by Name
|
56
|
-
|
57
|
-
```ruby
|
58
|
-
client.get_list_for_board_by_name(
|
59
|
-
board_id: client.get_board_by_name['id'],
|
60
|
-
list_name: 'User Requests'
|
61
|
-
)
|
62
|
-
```
|
63
|
-
|
64
|
-
### Add Card to List
|
65
|
-
|
66
|
-
```ruby
|
67
|
-
client.add_card!(
|
68
|
-
list_id: list_id,
|
69
|
-
title: 'API Card'
|
70
|
-
)
|
71
|
-
```
|
36
|
+
For usage see: <https://gitlab.com/charlescampbell1/trello_client/-/blob/master/USAGE.md>
|
72
37
|
|
73
38
|
## Contributing
|
74
39
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0
|
data/lib/trello/client.rb
CHANGED
@@ -14,26 +14,47 @@ module Trello
|
|
14
14
|
boards.select { |value| value['name'] == name }.first
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
18
|
-
|
19
|
-
end
|
17
|
+
def get_lists_for_board(board_id:)
|
18
|
+
options = { query: { key: key, token: token } }
|
20
19
|
|
21
|
-
|
22
|
-
|
20
|
+
request("boards/#{board_id}/lists") { |url| HTTParty.get(url, options) }
|
21
|
+
end
|
23
22
|
|
24
|
-
|
23
|
+
def get_list(board_id:, list_name:)
|
24
|
+
get_lists_for_board(board_id: board_id).select { |value| value['name'] == list_name }.first
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
27
|
+
def get_labels_for_board(board_id:)
|
28
28
|
options = { query: { key: key, token: token } }
|
29
29
|
|
30
|
-
request(
|
30
|
+
request("boards/#{board_id}/labels") { |url| HTTParty.get(url, options) }
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_label(board_id:, label_name:)
|
34
|
+
get_labels_for_board(board_id: board_id).select { |value| value['name'] == label_name }.first
|
35
|
+
end
|
36
|
+
|
37
|
+
# rubocop:disable Metrics/MethodLength
|
38
|
+
def add_card!(list_id:, title:, description: nil, labels: nil)
|
39
|
+
options = {
|
40
|
+
query: {
|
41
|
+
key: key,
|
42
|
+
token: token,
|
43
|
+
idList: list_id,
|
44
|
+
name: title,
|
45
|
+
desc: description,
|
46
|
+
idLabels: labels
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
request('cards') { |url| HTTParty.post(url, options) }
|
31
51
|
end
|
52
|
+
# rubocop:enable Metrics/MethodLength
|
32
53
|
|
33
|
-
def
|
54
|
+
def boards
|
34
55
|
options = { query: { key: key, token: token } }
|
35
56
|
|
36
|
-
request(
|
57
|
+
request('members/me/boards') { |url| HTTParty.get(url, options) }
|
37
58
|
end
|
38
59
|
|
39
60
|
private
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trello_client_lite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charlie Campbell
|
@@ -204,7 +204,8 @@ dependencies:
|
|
204
204
|
- - "~>"
|
205
205
|
- !ruby/object:Gem::Version
|
206
206
|
version: 0.18.1
|
207
|
-
description:
|
207
|
+
description: Light touch client gem for the trello API, current work in progress.
|
208
|
+
Designed for personal use in university project.
|
208
209
|
email:
|
209
210
|
- charlie.campbell14@gmail.com
|
210
211
|
executables: []
|