trello_client 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a85198454a25ff3a0623f1643445d8313670a939
4
- data.tar.gz: 91685449c5bfbe430a2b4f9facd1538dc5ffeee7
3
+ metadata.gz: d3af84755627b202d28e5693c6875d2eb186bb89
4
+ data.tar.gz: 2e24446fe0cbfb58f0e9cad89c8e37e0ecdb1e5d
5
5
  SHA512:
6
- metadata.gz: a3339653ee5da575a68b10f00ff8349ef9e26e7ea1ee7e935bc705a26bd307461d22b0260184ff984c568baf31d588c1dc5791684e3fbb56e2f216893bfa0621
7
- data.tar.gz: 15777c22465f981cb921d3393489eb396d5cdbf66df9b4b6d02a1b15d42849f7bd9bd56f7ec6ffe5311c79443e30341041b1fbdb7b0260063a349742fac7f61b
6
+ metadata.gz: c77e7283e195d22cfd6e43ca6037b19cc98f286e9d26989632a1cb6fcf5c9997a8b564108712c35feee4c1fe0180b1045dd9d59d9013c63c30977f76434abd30
7
+ data.tar.gz: 9460643291431d6630f2bb923c8af01be7822a50d77ee69be580766a5ae2f7520d6b588db186ab3704fc8fa2e36b613f34211deba481731a4180944db6b2e013
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # TrelloClient
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/trello_client`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Easy to use, non official Trello Client based on [Trello API Docs](https://trello.readme.io/docs/api-introduction).
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,7 +20,73 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ ### Get key and token
24
+
25
+ If this is your first time using Trello API, get key and token from [here](https://trello.com/app-key).
26
+
27
+ ### Client
28
+
29
+ Create board/list/card clients based on api key and token.
30
+
31
+ ```ruby
32
+ client = Trello::Client.new(key: <your-key>, token: <your-token>)
33
+ board_client = Trello::Board.new(client)
34
+ list_client = Trello::List.new(client)
35
+ card_client = Trello::Card.new(client)
36
+ ```
37
+
38
+ ### Board
39
+
40
+ Get all boards
41
+
42
+ ```ruby
43
+ board_client.fetch_all
44
+ ```
45
+
46
+ Get one board
47
+
48
+ ```ruby
49
+ board_client.fetch(id: <board-id>)
50
+ ```
51
+
52
+ ### List
53
+
54
+ Get all lists of a board
55
+
56
+ ```ruby
57
+ list_client.fetch_all(board_id: <board-id>)
58
+ ```
59
+
60
+ Get one list
61
+
62
+ ```ruby
63
+ list_client.fetch(id: <list-id>)
64
+ ```
65
+
66
+ ### Card
67
+
68
+ Get all cards of a list
69
+
70
+ ```ruby
71
+ card_client.fetch_all(list_id: <list-id>)
72
+ ```
73
+
74
+ Get one card
75
+
76
+ ```ruby
77
+ card_client.fetch(id: <card-id>)
78
+ ```
79
+
80
+ Create a card
81
+
82
+ ```ruby
83
+ # options of body(as a hash):
84
+ # - name: name of card
85
+ # - desc: description
86
+ # - ...
87
+ body = { name: "test", desc: "description", ... }
88
+ card_client.add(list_id: <list-id>, body)
89
+ ```
26
90
 
27
91
  ## Development
28
92
 
@@ -17,6 +17,11 @@ module Trello
17
17
  raise NotImplementedError
18
18
  end
19
19
 
20
+ def delete(id:)
21
+ raise unless id
22
+ @client.delete(resource_url(id))
23
+ end
24
+
20
25
  private
21
26
 
22
27
  def resources_url(**args)
@@ -10,6 +10,14 @@ module Trello
10
10
  super
11
11
  end
12
12
 
13
+ def add(**args)
14
+ @client.post("/1/boards", args)
15
+ end
16
+
17
+ def delete(id:)
18
+ super
19
+ end
20
+
13
21
  private
14
22
 
15
23
  def resources_url(**args)
@@ -13,6 +13,10 @@ module Trello
13
13
  @client.post("/1/cards", args.merge(idList: list_id))
14
14
  end
15
15
 
16
+ def delete(id:)
17
+ super
18
+ end
19
+
16
20
  private
17
21
 
18
22
  def resources_url(**args)
@@ -19,6 +19,10 @@ module Trello
19
19
  @http_client.perform(:post, with_key_and_token(path), body.to_json)
20
20
  end
21
21
 
22
+ def delete(path)
23
+ @http_client.perform(:delete, with_key_and_token(path))
24
+ end
25
+
22
26
  private
23
27
 
24
28
  def with_key_and_token(path)
@@ -9,6 +9,10 @@ module Trello
9
9
  super
10
10
  end
11
11
 
12
+ def add(board_id:, **args)
13
+ @client.post("/1/lists", args.merge(idBoard: board_id))
14
+ end
15
+
12
16
  private
13
17
 
14
18
  def resources_url(**args)
@@ -8,5 +8,5 @@ require "trello/list"
8
8
  require "trello/card"
9
9
 
10
10
  module TrelloClient
11
- VERSION = "0.2.0"
11
+ VERSION = "0.3.0"
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trello_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chen Huang