trello_client_lite 1.1.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -40
  3. data/VERSION +1 -1
  4. data/lib/trello/client.rb +31 -10
  5. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 276b444efb7291fb586a580c6347f7296290f71379f40dd244abd0e8a8d9e64b
4
- data.tar.gz: 23c32cd738097a356aaebb099775d4b6275783e0b5fcd840fdf83a8a12a49a9d
3
+ metadata.gz: 4c26b527d461296dd8c259a4f9322a9c1c17c9b95bcd43af9d2a67911f1b724f
4
+ data.tar.gz: 8ed0c05c58aeb710621f93223150ded5b054ba802138422b647f26afb29c9541
5
5
  SHA512:
6
- metadata.gz: 0bf912bb0cca3c1afa826e85784d713a5d1950099d203ce2bc75aabf74e253d09672fa2912fda21b91b6e14832367281d4c4fb3c545b5e276225794ba98d17cb
7
- data.tar.gz: c33c904f850ac30cccb6d64f2e2b5c85494ce39c01a8940b51dd221159cb906281aee05937e9c07304e36510ba7650f3bcb88a33a19c80c0f536be090eb594d1
6
+ metadata.gz: 0ec3eb2d4c7fb728722af330c73678e3701f7261af61cc3f393462135bde3b505c6b4eafc1a8e690a8592a2ceb5130d8e4cec1ce12f2f41d484d84fdbc0e67a2
7
+ data.tar.gz: 200c9934aa0654173406654baeaa0cf6c683b196e3dd4f439c1256406f194e8fa23492ce30a894dc8af146f87071f2670663d502bd25b9563cb1048007163462
data/README.md CHANGED
@@ -1,7 +1,10 @@
1
1
  # Trello Client
2
2
 
3
- A simple gem for interacting with basic endpoints of the Trello RestAPI.
3
+ ![Build Status](https://img.shields.io/badge/build-passing-4DC729.svg)
4
+ ![Coverage](https://img.shields.io/badge/coverage-100%25-4DC729.svg)
5
+ ![Release](https://img.shields.io/badge/ruby-2.7.1-E01663.svg)
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
- ## Usage
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.1.2
1
+ 2.0.0
@@ -14,26 +14,47 @@ 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
17
+ def get_lists_for_board(board_id:)
18
+ options = { query: { key: key, token: token } }
20
19
 
21
- def add_card!(list_id:, title:)
22
- options = { query: { key: key, token: token, idList: list_id, name: title } }
20
+ request("boards/#{board_id}/lists") { |url| HTTParty.get(url, options) }
21
+ end
23
22
 
24
- request('cards') { |url| HTTParty.post(url, options) }
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 boards
27
+ def get_labels_for_board(board_id:)
28
28
  options = { query: { key: key, token: token } }
29
29
 
30
- request('members/me/boards') { |url| HTTParty.get(url, options) }
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 lists(board_id)
54
+ def boards
34
55
  options = { query: { key: key, token: token } }
35
56
 
36
- request("boards/#{board_id}/lists") { |url| HTTParty.get(url, options) }
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: 1.1.2
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: Client gem for Trello API
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: []