trello_client_lite 1.0.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -7
- data/VERSION +1 -1
- data/lib/trello/client.rb +20 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8935cb9b1408d805245e88af703fa7e402abeffcef83cfba6e8812f5dca35707
|
4
|
+
data.tar.gz: be1949ccbc890ad973cee8260770e9887a6cda9108683c210003ebe68dfae86d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee4eb11f52f5c189253b1330481490caa7cf2e09fe10041e80f63d9faf29c126c6e42e0de5e32f90d77c4ade83a9a6158d20ec247417150886dc67015936ef65
|
7
|
+
data.tar.gz: e4b006afde659d122c5f4d45b238b0b69db657973de255c2760103d0489769638bcc41720644deef7a58bded28855d59a86ece7376415516390394fd7fe7e8f6
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Trello Client
|
2
2
|
|
3
|
-
A simple gem for interacting with basic endpoints of the Trello RestAPI
|
3
|
+
A simple gem for interacting with basic endpoints of the Trello RestAPI.
|
4
|
+
|
5
|
+
<https://rubygems.org/gems/trello_client_lite>
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
@@ -50,6 +52,24 @@ want to return.
|
|
50
52
|
client.get_board_by_name(name: 'My Trello Board')
|
51
53
|
```
|
52
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
|
+
```
|
72
|
+
|
53
73
|
## Contributing
|
54
74
|
|
55
75
|
This project has a few rules which applies to all contributions:
|
@@ -141,9 +161,5 @@ npm install -g standard-version
|
|
141
161
|
with a `v` prefix.
|
142
162
|
3. Push the `release` branch, but not the git tag: `git push origin release`
|
143
163
|
4. Open a Pull Request.
|
144
|
-
5.
|
145
|
-
6.
|
146
|
-
7. Push the git tag: `git push origin v<VERSION>`
|
147
|
-
8. Delete the `release` branch from the remote:
|
148
|
-
`git push origin --delete release`
|
149
|
-
9. All done.
|
164
|
+
5. Once the Pull Request is merged and back in master build the gem: `make build`
|
165
|
+
6. Push this gem to rubygems.org: `gem push trello_client_lite-x.x.x.gem`
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.1
|
data/lib/trello/client.rb
CHANGED
@@ -14,10 +14,22 @@ module Trello
|
|
14
14
|
boards.select { |value| value['name'] == name }.first
|
15
15
|
end
|
16
16
|
|
17
|
+
def get_list_for_board_by_name(board_id:, list_name:)
|
18
|
+
lists(board_id).select { |value| value['name'] == list_name }.first
|
19
|
+
end
|
20
|
+
|
21
|
+
def add_card!(list_id:, title:)
|
22
|
+
options = { query: { key: key, token: token, idList: list_id, name: title } }
|
23
|
+
|
24
|
+
request('cards') { |url| HTTParty.post(url, options) }
|
25
|
+
end
|
26
|
+
|
17
27
|
private
|
18
28
|
|
29
|
+
attr_reader :base_url, :key, :token
|
30
|
+
|
19
31
|
def request(endpoint)
|
20
|
-
url = "#{
|
32
|
+
url = "#{base_url}/#{endpoint}"
|
21
33
|
response = yield(url)
|
22
34
|
|
23
35
|
return JSON.parse(response.body) if response.code.eql?(200)
|
@@ -33,9 +45,15 @@ module Trello
|
|
33
45
|
end
|
34
46
|
|
35
47
|
def boards
|
36
|
-
options = { query: { key:
|
48
|
+
options = { query: { key: key, token: token } }
|
37
49
|
|
38
50
|
request('members/me/boards') { |url| HTTParty.get(url, options) }
|
39
51
|
end
|
52
|
+
|
53
|
+
def lists(board_id)
|
54
|
+
options = { query: { key: key, token: token } }
|
55
|
+
|
56
|
+
request("boards/#{board_id}/lists") { |url| HTTParty.get(url, options) }
|
57
|
+
end
|
40
58
|
end
|
41
59
|
end
|