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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +23 -7
  3. data/VERSION +1 -1
  4. data/lib/trello/client.rb +20 -2
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0e399125cb65919ae25688cf9a3c1ca27eb00fd6681c71a2585655b37f5c61c
4
- data.tar.gz: 350f887da04a472c43879270cc5a1ec692f9085b7aa3f5c69242ef12c14b6bce
3
+ metadata.gz: 8935cb9b1408d805245e88af703fa7e402abeffcef83cfba6e8812f5dca35707
4
+ data.tar.gz: be1949ccbc890ad973cee8260770e9887a6cda9108683c210003ebe68dfae86d
5
5
  SHA512:
6
- metadata.gz: 7cd21758d4d126b6fd3698b2bbb9919e91f221702743dd7c1361812ce00d4a26c13eced3c45c45659a1df5d4df6c6c48abd62e8d830c11e54a3aaea66d8e1904
7
- data.tar.gz: c86c68df7197e3248eea0d18868c2fe0af3303d9e75a5389cc11a09750c234778a418af282748da41c583d90082b4e765cb771422e11e3dc6b489986855f7a01
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. When Pull Request has been approved, merge it WITHOUT deleting the branch.
145
- 6. Run the release target for ruby gems `make release`
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.0.0
1
+ 1.1.1
@@ -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 = "#{@base_url}/#{endpoint}"
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: @key, token: @token } }
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
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.0.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charlie Campbell