tacokit 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b75eee59cb13c98fd302c0312c10ad5f2a8cf221
4
- data.tar.gz: 804f984972f9e6178aa00c562d4a3f1ba10e89ba
3
+ metadata.gz: 721bdb7f3d850839c9e9dc12ccdba8452f03ca72
4
+ data.tar.gz: a1da08c3defaa5806675b86795b11613d97bfbc0
5
5
  SHA512:
6
- metadata.gz: 541a773ea4ed06aadab7d714323b956ed980cdef9002ad0c2099ab6d9aa33fb01277ce3d1656587a25ba6059f972bee5969e6af2fabdda154bd049d8edd0b615
7
- data.tar.gz: 35cc4c12739a20f87c596e5e3fb218f03d94f94e388d5813c6d26a09de02234c663d6bc51206d8e3d5ec683e574986948c8ce2171c8614d1b340c81d4acb1f3d
6
+ metadata.gz: 4b4d275d708a8ab1694183e25370252710c3e23aec78c80d30f40429f3926b242fb138f6a79ad4e7ddd61ea71c1f688026f334b436784339975d131f2f45fab5
7
+ data.tar.gz: bdc5d9afbb8b9917237a33b3197f3d3800e9a75b94afa99bd90b2e400a25587eb80d515f3dcc4f54a74dbaec8970f0b48e9a81c6793c6e332d766684daae635c
data/.gitignore CHANGED
@@ -14,3 +14,4 @@
14
14
  mkmf.log
15
15
  .env
16
16
  .env.development
17
+ .ruby-version
@@ -86,8 +86,8 @@ module Tacokit
86
86
  get action_path(action_id, *paths), options
87
87
  end
88
88
 
89
- def action_path(*paths)
90
- path_join("actions", *paths)
89
+ def action_path(action_id, *paths)
90
+ resource_path("actions", action_id, *paths)
91
91
  end
92
92
  end
93
93
  end
@@ -98,7 +98,7 @@ module Tacokit
98
98
 
99
99
  # POST /1/boards
100
100
  def create_board(name, options = {})
101
- post board_path, options.merge(name: name)
101
+ post "boards", options.merge(name: name)
102
102
  end
103
103
 
104
104
  private
@@ -123,8 +123,8 @@ module Tacokit
123
123
  paginated_get board_path(board_id, *paths), options
124
124
  end
125
125
 
126
- def board_path(*paths)
127
- path_join("boards", *paths)
126
+ def board_path(board_id, *paths)
127
+ resource_path("boards", board_id, *paths)
128
128
  end
129
129
  end
130
130
  end
@@ -162,7 +162,7 @@ module Tacokit
162
162
  #
163
163
  # @see https://trello.com/docs/api/card/index.html#post-1-cards
164
164
  def create_card(list_id, name = nil, options = {})
165
- post card_path, options.merge(name: name, list_id: list_id)
165
+ post "cards", options.merge(name: name, list_id: list_id)
166
166
  end
167
167
 
168
168
  # Add a comment to a card
@@ -330,8 +330,8 @@ module Tacokit
330
330
  delete card_path(card_id, camp(resource), *paths)
331
331
  end
332
332
 
333
- def card_path(*paths)
334
- base_path "cards", *paths
333
+ def card_path(card_id, *paths)
334
+ resource_path("cards", card_id, *paths)
335
335
  end
336
336
  end
337
337
  end
@@ -43,7 +43,7 @@ module Tacokit
43
43
  # @see https://trello.com/docs/api/checklist/index.html#post-1-checklists
44
44
  def create_checklist(card_id, name, options = {})
45
45
  options.update card_id: card_id, name: name
46
- post checklist_path, options
46
+ post "checklists", options
47
47
  end
48
48
  alias_method :checklist_create, :create_checklist
49
49
 
@@ -71,8 +71,8 @@ module Tacokit
71
71
  get checklist_path(checklist_id, *paths), options
72
72
  end
73
73
 
74
- def checklist_path(*paths)
75
- path_join("checklists", *paths)
74
+ def checklist_path(checklist_id, *paths)
75
+ resource_path("checklists", checklist_id, *paths)
76
76
  end
77
77
  end
78
78
  end
@@ -19,7 +19,7 @@ module Tacokit
19
19
  #
20
20
  # @see https://trello.com/docs/api/label/index.html#post-1-labels
21
21
  def create_label(board_id, name, color)
22
- post label_path,
22
+ post "labels",
23
23
  board_id: board_id,
24
24
  name: name,
25
25
  color: color
@@ -34,8 +34,8 @@ module Tacokit
34
34
 
35
35
  private
36
36
 
37
- def label_path(*paths)
38
- path_join "labels", *paths
37
+ def label_path(label_id, *paths)
38
+ resource_path "labels", label_id, *paths
39
39
  end
40
40
  end
41
41
  end
@@ -40,7 +40,7 @@ module Tacokit
40
40
  #
41
41
  # @see https://trello.com/docs/api/list/index.html#post-1-lists
42
42
  def create_list(board_id, name, options = {})
43
- post list_path, options.merge(name: name, board_id: board_id)
43
+ post "lists", options.merge(name: name, board_id: board_id)
44
44
  end
45
45
 
46
46
  # Archive all cards in a list
@@ -70,8 +70,8 @@ module Tacokit
70
70
  paginated_get list_path(list_id, *paths), options
71
71
  end
72
72
 
73
- def list_path(*paths)
74
- path_join("lists", *paths)
73
+ def list_path(list_id, *paths)
74
+ resource_path("lists", list_id, *paths)
75
75
  end
76
76
  end
77
77
  end
@@ -5,6 +5,7 @@ module Tacokit
5
5
  #
6
6
  # @see https://trello.com/docs/api/member/index.html#get-1-members-idmember-or-username
7
7
  def member(username = "me", options = nil)
8
+ username, options = extract_member_args(username, options)
8
9
  get member_path(username), options
9
10
  end
10
11
 
@@ -12,10 +13,7 @@ module Tacokit
12
13
  #
13
14
  # @see https://trello.com/docs/api/member/index.html#get-1-members-idmember-or-username-actions
14
15
  def actions(username = "me", options = {})
15
- if username.is_a?(Hash)
16
- username = "me"
17
- options = username
18
- end
16
+ username, options = extract_member_args(username, options)
19
17
  paginated_get member_path(username, "actions"), options
20
18
  end
21
19
  alias_method :member_actions, :actions
@@ -24,6 +22,7 @@ module Tacokit
24
22
  #
25
23
  # @see https://trello.com/docs/api/member/index.html#get-1-members-idmember-or-username-boards
26
24
  def boards(username = "me", options = {})
25
+ username, options = extract_member_args(username, options)
27
26
  get member_path(username, "boards"), options
28
27
  end
29
28
 
@@ -31,6 +30,7 @@ module Tacokit
31
30
  #
32
31
  # @see https://trello.com/docs/api/member/index.html#get-1-members-idmember-or-username-cards
33
32
  def cards(username = "me", options = {})
33
+ username, options = extract_member_args(username, options)
34
34
  get member_path(username, "cards"), options
35
35
  end
36
36
 
@@ -38,6 +38,7 @@ module Tacokit
38
38
  #
39
39
  # @see https://trello.com/docs/api/member/index.html#get-1-members-idmember-or-username-notifications
40
40
  def notifications(username = "me", options = {})
41
+ username, options = extract_member_args(username, options)
41
42
  paginated_get member_path(username, "notifications"), options
42
43
  end
43
44
 
@@ -45,6 +46,7 @@ module Tacokit
45
46
  #
46
47
  # @see https://trello.com/docs/api/member/index.html#get-1-members-idmember-or-username-organizations
47
48
  def organizations(username = "me", options = {})
49
+ username, options = extract_member_args(username, options)
48
50
  get member_path(username, "organizations"), options
49
51
  end
50
52
 
@@ -52,6 +54,7 @@ module Tacokit
52
54
  #
53
55
  # @see https://trello.com/docs/api/member/index.html#get-1-members-idmember-or-username-tokens
54
56
  def tokens(username = "me", options = {})
57
+ username, options = extract_member_args(username, options)
55
58
  get member_path(username, "tokens"), options
56
59
  end
57
60
 
@@ -93,8 +96,13 @@ module Tacokit
93
96
  get(member_path(username, *paths), options)
94
97
  end
95
98
 
96
- def member_path(*paths)
97
- path_join "members", *paths
99
+ def member_path(member_id, *paths)
100
+ resource_path("members", member_id, *paths)
101
+ end
102
+
103
+ def extract_member_args(username, options)
104
+ options, username = username, "me" if username.is_a?(Hash)
105
+ [username, options]
98
106
  end
99
107
  end
100
108
  end
@@ -26,8 +26,8 @@ module Tacokit
26
26
  get notification_path(notification_id, *paths), options
27
27
  end
28
28
 
29
- def notification_path(*paths)
30
- path_join "notifications", *paths
29
+ def notification_path(notification_id, *paths)
30
+ resource_path "notifications", notification_id, *paths
31
31
  end
32
32
  end
33
33
  end
@@ -48,7 +48,7 @@ module Tacokit
48
48
 
49
49
  # POST /1/organizations
50
50
  def create_organization(display_name, options = {})
51
- post organization_path, options.merge(display_name: display_name)
51
+ post "organizations", options.merge(display_name: display_name)
52
52
  end
53
53
 
54
54
  # POST /1/organizations/[idOrg or name]/logo
@@ -65,8 +65,8 @@ module Tacokit
65
65
  # prefs/associatedDomain
66
66
  # prefs/orgInviteRestrict
67
67
 
68
- def organization_path(*paths)
69
- path_join "organizations", *paths
68
+ def organization_path(org_id, *paths)
69
+ resource_path "organizations", org_id, *paths
70
70
  end
71
71
  end
72
72
  end
@@ -3,7 +3,7 @@ module Tacokit
3
3
  module Types
4
4
  # GET /1/types/[id]
5
5
  def type(model_id)
6
- get path_join "types", model_id
6
+ get resource_path "types", model_id
7
7
  end
8
8
  end
9
9
  end
@@ -22,7 +22,7 @@ module Tacokit
22
22
  options.update \
23
23
  model_id: model_id,
24
24
  callback_url: callback_url
25
- post webhook_path, options
25
+ post "webhooks", options
26
26
  end
27
27
 
28
28
  # DELETE /1/webhooks/[idWebhook]
@@ -30,8 +30,10 @@ module Tacokit
30
30
  delete webhook_path(webhook_id)
31
31
  end
32
32
 
33
- def webhook_path(*paths)
34
- path_join "webhooks", *paths
33
+ private
34
+
35
+ def webhook_path(webhook_id, *paths)
36
+ resource_path "webhooks", webhook_id, *paths
35
37
  end
36
38
  end
37
39
  end
@@ -1,4 +1,5 @@
1
1
  require "set"
2
+ require "time"
2
3
  require "forwardable"
3
4
 
4
5
  module Tacokit
@@ -132,7 +133,7 @@ module Tacokit
132
133
  # rubocop:enable Metrics/LineLength
133
134
  def cast_value_type(value)
134
135
  case value
135
- when ISO8601 then DateTime.parse(value)
136
+ when ISO8601 then Time.parse(value)
136
137
  else value
137
138
  end
138
139
  rescue
data/lib/tacokit/utils.rb CHANGED
@@ -47,6 +47,12 @@ module Tacokit
47
47
  paths.join("/")
48
48
  end
49
49
 
50
+ # Returns a resource path for a given resource name and id
51
+ def resource_path(resource_name, resource_id, *paths)
52
+ resource_id = resource_id.id if resource_id.respond_to?(:id)
53
+ path_join resource_name, resource_id, *paths
54
+ end
55
+
50
56
  def constantize(class_name)
51
57
  Tacokit.const_get(camelize(singularize(class_name.to_s)))
52
58
  rescue NameError
@@ -1,3 +1,3 @@
1
1
  module Tacokit
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -0,0 +1 @@
1
+ {"http_interactions":[{"request":{"method":"get","uri":"https://api.trello.com/1/members/me/boards?fields=id,name&key=<TRELLO_APP_KEY>&token=<TRELLO_APP_TOKEN>","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"User-Agent":["TacoKit 0.0.1"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"Accept":["*/*"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Cache-Control":["max-age=0, must-revalidate, no-cache, no-store"],"X-Content-Type-Options":["nosniff"],"Strict-Transport-Security":["max-age=15768000"],"X-Xss-Protection":["1; mode=block"],"X-Frame-Options":["DENY"],"X-Trello-Version":["1.312.0"],"X-Trello-Environment":["Production"],"Set-Cookie":["dsc=43c56f9a9882af6cf69f29f215864f24d6d6e9dce0758c71fcb2c68f839fb88f; Path=/; Expires=Fri, 06 Mar 2015 13:13:18 GMT; Secure","incap_ses_163_168562=a33jAYTcOATT8vHe9hhDAm6z9VQAAAAALJvM/O4QBMrTc6RBHXaH9g==; path=/; Domain=.trello.com","visid_incap_168562=FEPEM1XqRVGO4v4AmmJ83W6z9VQAAAAAQUIPAAAAAADeFcSkcw3T1urZi0NBCmGf; expires=Thu, 02 Mar 2017 04:02:38 GMT; path=/; Domain=.trello.com"],"X-Server-Time":["1425388398577"],"Expires":["Thu, 01 Jan 1970 00:00:00"],"Content-Type":["application/json; charset=utf-8"],"Access-Control-Allow-Origin":["*"],"Access-Control-Allow-Methods":["GET, PUT, POST, DELETE"],"Content-Length":["548"],"Etag":["W/\"224-13588f04\""],"Vary":["Accept-Encoding"],"Date":["Tue, 03 Mar 2015 13:13:18 GMT"],"X-Iinfo":["8-32517542-32514495 PNNY RT(1425388398048 40) q(0 0 0 -1) r(1 1)"],"X-Cdn":["Incapsula"]},"body":{"encoding":"UTF-8","base64_string":"W3sibmFtZSI6IkFsdGVybmF0ZSBUZXN0IEJvYXJkIiwiaWQiOiI1NGYzNzFi\nNDA4Njc4MWUxYTcxYjYxMTEifSx7Im5hbWUiOiJBdXRvYm9hcmQiLCJpZCI6\nIjU0OTI0ZDAyM2VjOTA4NzBlOTExOTQ2ZCJ9LHsibmFtZSI6IkF1dG9ib2Fy\nZCIsImlkIjoiNTQ5MjYzYjI1MTBmZmEzYjM5YTMyM2E4In0seyJuYW1lIjoi\nQXV0b2JvYXJkIiwiaWQiOiI1NDkyNjNlNTE2ZGQzYWMwNmRhODA0MzcifSx7\nIm5hbWUiOiJBdXRvYm9hcmQiLCJpZCI6IjU0OTI2NDNlYzMxYzZmNGIzOTJi\nMmM4NCJ9LHsibmFtZSI6IkF1dG9ib2FyZCIsImlkIjoiNTQ5MjY0NjhhYWQz\nMDg4YjM4MWZjNTNjIn0seyJuYW1lIjoiQXV0b2JvYXJkIiwiaWQiOiI1NGIz\nZDg1YzE5Y2E5MmJjM2E3OThkNDAifSx7Im5hbWUiOiJUZXN0IEJvYXJkIiwi\naWQiOiI1NDhhNjc1NTgxZDFkNjY5YzllODE4NGUifSx7Im5hbWUiOiJXZWxj\nb21lIEJvYXJkIiwiaWQiOiI1NDhhNjY5NmIzYjk5MThiZWIxNDRiMDgifSx7\nIm5hbWUiOiJ0YWNva2l0LnJiIiwiaWQiOiI1NDk2YzJhNTkzOTAxYzJlYjNh\nZjViYzYifV0=\n"},"http_version":null},"recorded_at":"Tue, 03 Mar 2015 13:13:18 GMT"}],"recorded_with":"VCR 2.9.3"}
@@ -0,0 +1 @@
1
+ {"http_interactions":[{"request":{"method":"get","uri":"https://api.trello.com/1/members/me?key=<TRELLO_APP_KEY>&token=<TRELLO_APP_TOKEN>","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"User-Agent":["TacoKit 0.0.1"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"Accept":["*/*"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Cache-Control":["max-age=0, must-revalidate, no-cache, no-store"],"X-Content-Type-Options":["nosniff"],"Strict-Transport-Security":["max-age=15768000"],"X-Xss-Protection":["1; mode=block"],"X-Frame-Options":["DENY"],"X-Trello-Version":["1.312.0"],"X-Trello-Environment":["Production"],"Set-Cookie":["___utmvaaVussFI=RTI\u0001AVfy; path=/; Max-Age=900","___utmvbaVussFI=sZm XVEOJaln: Ktb; path=/; Max-Age=900","___utmvmaVussFI=JoPvQtLqPBZ; path=/; Max-Age=900","dsc=ed61a76bcbf052b71794a5daa2eb1765e8e6e4a7c2708609d7985a5a2c684369; Path=/; Expires=Fri, 06 Mar 2015 13:24:08 GMT; Secure","incap_ses_239_168562=X4MjP7cfoWQOaEpFRRpRA/e19VQAAAAAAcI6p+79t76s16MJEsuLUw==; path=/; Domain=.trello.com","visid_incap_168562=hJZvf+9sTauudoQGc9ulJve19VQAAAAAQUIPAAAAAACme3ezr5PSsLIyezkqouW0; expires=Thu, 02 Mar 2017 12:25:26 GMT; path=/; Domain=.trello.com"],"X-Server-Time":["1425389048030"],"Expires":["Thu, 01 Jan 1970 00:00:00"],"Content-Type":["application/json; charset=utf-8"],"Access-Control-Allow-Origin":["*"],"Access-Control-Allow-Methods":["GET, PUT, POST, DELETE"],"Etag":["W/\"dZaj8rqSe4i6CuvclEsNWw==\""],"Vary":["Accept-Encoding"],"Date":["Tue, 03 Mar 2015 13:24:08 GMT"],"Transfer-Encoding":["chunked"],"X-Iinfo":["7-9498078-9498082 NNNN CT(13 13 0) RT(1425389046995 86) q(0 0 1 0) r(1 1)"],"X-Cdn":["Incapsula"]},"body":{"encoding":"UTF-8","base64_string":"eyJpZCI6IjU0OGE2Njk2YjNiOTkxOGJlYjE0NGIwNyIsImF2YXRhckhhc2gi\nOiJjYjBkZjQ1MDU1YmFjODRlN2M1ZmI3MjhlMDBlMjAxNSIsImJpbyI6IlRh\nY29raXQgcHV0cyB0aGUgVHJlbGxvIEFQSSBvbiBSdWJ5IiwiYmlvRGF0YSI6\neyJlbW9qaSI6e319LCJjb25maXJtZWQiOnRydWUsImZ1bGxOYW1lIjoiVGFj\nbyBLaXQiLCJpZFByZW1PcmdzQWRtaW4iOltdLCJpbml0aWFscyI6IlRLIiwi\nbWVtYmVyVHlwZSI6Im5vcm1hbCIsInByb2R1Y3RzIjpbXSwic3RhdHVzIjoi\naWRsZSIsInVybCI6Imh0dHBzOi8vdHJlbGxvLmN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n"},"http_version":null},"recorded_at":"Tue, 03 Mar 2015 13:24:07 GMT"},{"request":{"method":"get","uri":"https://api.trello.com/1/members/me?key=<TRELLO_APP_KEY>&token=<TRELLO_APP_TOKEN>","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"User-Agent":["TacoKit 0.0.1"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"Accept":["*/*"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Cache-Control":["max-age=0, must-revalidate, no-cache, no-store"],"X-Content-Type-Options":["nosniff"],"Strict-Transport-Security":["max-age=15768000"],"X-Xss-Protection":["1; mode=block"],"X-Frame-Options":["DENY"],"X-Trello-Version":["1.312.0"],"X-Trello-Environment":["Production"],"Set-Cookie":["___utmvaaVussFI=zSQ\u0001peNs; path=/; Max-Age=900","___utmvbaVussFI=bZY XQMOLale: ttv; path=/; Max-Age=900","___utmvmaVussFI=OdPZvPOyTxm; path=/; Max-Age=900","dsc=28e1e3f47172ae711d200c60d357e5426e50fc3c765c24b660b9cc37189c7b68; Path=/; Expires=Fri, 06 Mar 2015 13:24:08 GMT; Secure","incap_ses_239_168562=K9iLAMWblBcOaEpFRRpRA/e19VQAAAAAChHf0aPLJL4cm4En1TJuNg==; path=/; Domain=.trello.com","visid_incap_168562=hJZvf+9sTauudoQGc9ulJve19VQAAAAAQUIPAAAAAACme3ezr5PSsLIyezkqouW0; expires=Thu, 02 Mar 2017 12:25:26 GMT; path=/; Domain=.trello.com"],"X-Server-Time":["1425389048265"],"Expires":["Thu, 01 Jan 1970 00:00:00"],"Content-Type":["application/json; charset=utf-8"],"Access-Control-Allow-Origin":["*"],"Access-Control-Allow-Methods":["GET, PUT, POST, DELETE"],"Etag":["W/\"dZaj8rqSe4i6CuvclEsNWw==\""],"Vary":["Accept-Encoding"],"Date":["Tue, 03 Mar 2015 13:24:08 GMT"],"Transfer-Encoding":["chunked"],"X-Iinfo":["10-29357731-29357198 PNNN RT(1425389047254 92) q(0 0 0 0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WRPcmdhbml6YXRpb25zIjpbIjU0OGUzMGU5NjgzZTE5MjNm\nNjc2YmEyMCJdLCJsb2dpblR5cGVzIjpbInBhc3N3b3JkIl0sIm9uZVRpbWVN\nZXNzYWdlc0Rpc21pc3NlZCI6W10sInByZWZzIjp7ImNvbG9yQmxpbmQiOnRy\ndWUsIm1pbnV0ZXNCZWZvcmVEZWFkbGluZVRvTm90aWZ5IjoxNDQwLCJtaW51\ndGVzQmV0d2VlblN1bW1hcmllcyI6MSwic2VuZFN1bW1hcmllcyI6dHJ1ZX0s\nInRyb3BoaWVzIjpbXSwidXBsb2FkZWRBdmF0YXJIYXNoIjoiY2IwZGY0NTA1\nNWJhYzg0ZTdjNWZiNzI4ZTAwZTIwMTUiLCJwcmVtaXVtRmVhdHVyZXMiOltd\nLCJpZEJvYXJkc1Bpbm5lZCI6bnVsbH0=\n"},"http_version":null},"recorded_at":"Tue, 03 Mar 2015 13:24:07 GMT"},{"request":{"method":"get","uri":"https://api.trello.com/1/members/548a6696b3b9918beb144b07?key=<TRELLO_APP_KEY>&token=<TRELLO_APP_TOKEN>","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"User-Agent":["TacoKit 0.0.1"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"Accept":["*/*"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Cache-Control":["max-age=0, must-revalidate, no-cache, no-store"],"X-Content-Type-Options":["nosniff"],"Strict-Transport-Security":["max-age=15768000"],"X-Xss-Protection":["1; mode=block"],"X-Frame-Options":["DENY"],"X-Trello-Version":["1.312.0"],"X-Trello-Environment":["Production"],"Set-Cookie":["___utmvaaVussFI=gLh\u0001eSKt; path=/; Max-Age=900","___utmvbaVussFI=AZQ XppOtalu: LtP; path=/; Max-Age=900","___utmvmaVussFI=BQgzAGPyNyj; path=/; Max-Age=900","dsc=630ec5ee40512aa30a8e0e3dabc7ba2bbf1a35e7a4197b0355c4923d2b6e2129; Path=/; Expires=Fri, 06 Mar 2015 13:24:08 GMT; Secure","incap_ses_239_168562=ieYRcPp3NVMOaEpFRRpRA/e19VQAAAAAb0f9ZBtpuXRjY4hndhsaUA==; path=/; Domain=.trello.com","visid_incap_168562=hJZvf+9sTauudoQGc9ulJve19VQAAAAAQUIPAAAAAACme3ezr5PSsLIyezkqouW0; expires=Thu, 02 Mar 2017 12:25:26 GMT; path=/; Domain=.trello.com"],"X-Server-Time":["1425389048493"],"Expires":["Thu, 01 Jan 1970 00:00:00"],"Content-Type":["application/json; charset=utf-8"],"Access-Control-Allow-Origin":["*"],"Access-Control-Allow-Methods":["GET, PUT, POST, DELETE"],"Etag":["W/\"dZaj8rqSe4i6CuvclEsNWw==\""],"Vary":["Accept-Encoding"],"Date":["Tue, 03 Mar 2015 13:24:08 GMT"],"Transfer-Encoding":["chunked"],"X-Iinfo":["7-9498096-9498082 PNNN RT(1425389047484 82) q(0 0 0 0) r(1 1)"],"X-Cdn":["Incapsula"]},"body":{"encoding":"UTF-8","base64_string":"eyJpZCI6IjU0OGE2Njk2YjNiOTkxOGJlYjE0NGIwNyIsImF2YXRhckhhc2gi\nOiJjYjBkZjQ1MDU1YmFjODRlN2M1ZmI3MjhlMDBlMjAxNSIsImJpbyI6IlRh\nY29raXQgcHV0cyB0aGUgVHJlbGxvIEFQSSBvbiBSdWJ5IiwiYmlvRGF0YSI6\neyJlbW9qaSI6e319LCJjb25maXJtZWQiOnRydWUsImZ1bGxOYW1lIjoiVGFj\nbyBLaXQiLCJpZFByZW1PcmdzQWRtaW4iOltdLCJpbml0aWFscyI6IlRLIiwi\nbWVtYmVyVHlwZSI6Im5vcm1hbCIsInByb2R1Y3RzIjpbXSwic3RhdHVzIjoi\naWRsZSIsInVybCI6Imh0dHBzOi8vdHJlbGxvLmNvbS90YWNva2l0IiwidXNl\ncm5hbWUiOiJ0YWNva2l0IiwiYXZhdGFyU291cmNlIjoidXBsb2FkIiwiZW1h\naWwiOiJyb3Nza2FmZit0YWNvc2hlbGxAZ21haWw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co Kit")
16
16
  end
17
17
 
18
+ it "accepts a resource" do
19
+ member = app_client.member
20
+
21
+ member = app_client.member(member)
22
+
23
+ expect(member.full_name).to eq("Taco Kit")
24
+ end
25
+
18
26
  it "supports query fields as string or array" do
19
27
  member = app_client.member "tacokit",
20
28
  boards: "all",
@@ -65,6 +73,15 @@ describe Tacokit::Client::Members do
65
73
 
66
74
  assert_requested :get, trello_url_template("members/tacokit/boards{?key,token}")
67
75
  end
76
+
77
+ it "returns for 'me' with options as first arg" do
78
+ boards = app_client.boards(fields: %w[id name])
79
+
80
+ expect(boards).not_to be_empty
81
+
82
+ board = boards.first
83
+ expect(board.name).to be_present
84
+ end
68
85
  end
69
86
 
70
87
  describe "#cards", :vcr do
@@ -109,7 +109,7 @@ module Tacokit
109
109
  it "casts date timestamps" do
110
110
  res = Resource.new date: "2015-01-13T13:43:00.347Z"
111
111
 
112
- expect(res.date).to be_a(DateTime)
112
+ expect(res.date).to be_a(Time)
113
113
  end
114
114
 
115
115
  describe "#attrs" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tacokit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ross Kaffenberger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-02 00:00:00.000000000 Z
11
+ date: 2015-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -258,8 +258,10 @@ files:
258
258
  - spec/cassettes/Tacokit_Client_Lists/_update_list/updates_a_list.json
259
259
  - spec/cassettes/Tacokit_Client_Members/_actions/returns_member_actions.json
260
260
  - spec/cassettes/Tacokit_Client_Members/_board_stars/returns_member_board_stars.json
261
+ - spec/cassettes/Tacokit_Client_Members/_boards/returns_for_me_with_options_as_first_arg.json
261
262
  - spec/cassettes/Tacokit_Client_Members/_boards/returns_member_boards.json
262
263
  - spec/cassettes/Tacokit_Client_Members/_cards/returns_member_cards.json
264
+ - spec/cassettes/Tacokit_Client_Members/_member/accepts_a_resource.json
263
265
  - spec/cassettes/Tacokit_Client_Members/_member/authenticated/returns_self.json
264
266
  - spec/cassettes/Tacokit_Client_Members/_member/returns_a_member.json
265
267
  - spec/cassettes/Tacokit_Client_Members/_member/returns_self.json
@@ -477,8 +479,10 @@ test_files:
477
479
  - spec/cassettes/Tacokit_Client_Lists/_update_list/updates_a_list.json
478
480
  - spec/cassettes/Tacokit_Client_Members/_actions/returns_member_actions.json
479
481
  - spec/cassettes/Tacokit_Client_Members/_board_stars/returns_member_board_stars.json
482
+ - spec/cassettes/Tacokit_Client_Members/_boards/returns_for_me_with_options_as_first_arg.json
480
483
  - spec/cassettes/Tacokit_Client_Members/_boards/returns_member_boards.json
481
484
  - spec/cassettes/Tacokit_Client_Members/_cards/returns_member_cards.json
485
+ - spec/cassettes/Tacokit_Client_Members/_member/accepts_a_resource.json
482
486
  - spec/cassettes/Tacokit_Client_Members/_member/authenticated/returns_self.json
483
487
  - spec/cassettes/Tacokit_Client_Members/_member/returns_a_member.json
484
488
  - spec/cassettes/Tacokit_Client_Members/_member/returns_self.json