tacokit 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +4 -0
  4. data/.travis.yml +3 -0
  5. data/Gemfile +2 -1
  6. data/README.md +140 -47
  7. data/Rakefile +13 -0
  8. data/bin/_guard-core +16 -0
  9. data/bin/console +14 -0
  10. data/bin/guard +16 -0
  11. data/bin/rake +16 -0
  12. data/bin/rspec +16 -0
  13. data/bin/rubocop +16 -0
  14. data/bin/setup +7 -0
  15. data/lib/tacokit/authorization.rb +8 -9
  16. data/lib/tacokit/client.rb +14 -20
  17. data/lib/tacokit/client/actions.rb +30 -14
  18. data/lib/tacokit/client/boards.rb +112 -16
  19. data/lib/tacokit/client/cards.rb +251 -72
  20. data/lib/tacokit/client/checklists.rb +25 -14
  21. data/lib/tacokit/client/labels.rb +11 -4
  22. data/lib/tacokit/client/lists.rb +66 -13
  23. data/lib/tacokit/client/members.rb +118 -42
  24. data/lib/tacokit/client/notifications.rb +29 -2
  25. data/lib/tacokit/client/organizations.rb +13 -5
  26. data/lib/tacokit/client/searches.rb +17 -2
  27. data/lib/tacokit/client/tokens.rb +8 -2
  28. data/lib/tacokit/client/types.rb +4 -2
  29. data/lib/tacokit/client/webhooks.rb +17 -4
  30. data/lib/tacokit/collection.rb +6 -5
  31. data/lib/tacokit/configuration.rb +10 -2
  32. data/lib/tacokit/middleware.rb +16 -0
  33. data/lib/tacokit/resource.rb +7 -6
  34. data/lib/tacokit/transform.rb +2 -4
  35. data/lib/tacokit/utils.rb +7 -4
  36. data/lib/tacokit/version.rb +2 -1
  37. data/tacokit.gemspec +4 -4
  38. metadata +17 -273
  39. data/spec/cassettes/Tacokit_Client/_connection/authorized_GET_request_with_app_key_and_token_params.json +0 -1
  40. data/spec/cassettes/Tacokit_Client_Actions/_action/returns_a_token_authorized_action.json +0 -1
  41. data/spec/cassettes/Tacokit_Client_Actions/_action/returns_oauth_authorized_board.json +0 -1
  42. data/spec/cassettes/Tacokit_Client_Actions/_action_board/returns_action_board.json +0 -1
  43. data/spec/cassettes/Tacokit_Client_Actions/_action_card/returns_action_card.json +0 -1
  44. data/spec/cassettes/Tacokit_Client_Actions/_action_entities/returns_action_entities.json +0 -1
  45. data/spec/cassettes/Tacokit_Client_Actions/_action_list/returns_action_list.json +0 -1
  46. data/spec/cassettes/Tacokit_Client_Actions/_delete_action/deletes_an_action.json +0 -1
  47. data/spec/cassettes/Tacokit_Client_Actions/_update_action/updates_an_action.json +0 -1
  48. data/spec/cassettes/Tacokit_Client_Actions/_update_action_text/updates_an_action.json +0 -1
  49. data/spec/cassettes/Tacokit_Client_Boards/_add_board_member/adds_invites_member_to_board.json +0 -1
  50. data/spec/cassettes/Tacokit_Client_Boards/_board/returns_a_token_authorized_board.json +0 -1
  51. data/spec/cassettes/Tacokit_Client_Boards/_board/returns_oauth_authorized_board.json +0 -1
  52. data/spec/cassettes/Tacokit_Client_Boards/_board_actions/returns_board_actions.json +0 -1
  53. data/spec/cassettes/Tacokit_Client_Boards/_board_cards/returns_board_cards.json +0 -1
  54. data/spec/cassettes/Tacokit_Client_Boards/_board_checklists/returns_board_checklists.json +0 -1
  55. data/spec/cassettes/Tacokit_Client_Boards/_board_labels/returns_board_labels.json +0 -1
  56. data/spec/cassettes/Tacokit_Client_Boards/_board_lists/returns_board_lists.json +0 -1
  57. data/spec/cassettes/Tacokit_Client_Boards/_board_members/returns_board_members.json +0 -1
  58. data/spec/cassettes/Tacokit_Client_Boards/_board_organization/returns_board_organization.json +0 -1
  59. data/spec/cassettes/Tacokit_Client_Boards/_board_preferences/returns_preferences_for_a_board.json +0 -1
  60. data/spec/cassettes/Tacokit_Client_Boards/_board_stars/returns_board_stars.json +0 -1
  61. data/spec/cassettes/Tacokit_Client_Boards/_update_board/updates_a_board.json +0 -1
  62. data/spec/cassettes/Tacokit_Client_Boards/_update_board/updates_nested_resource.json +0 -1
  63. data/spec/cassettes/Tacokit_Client_Boards/_update_board_member/updates_member.json +0 -1
  64. data/spec/cassettes/Tacokit_Client_Cards/_add_comment/creates_a_comment.json +0 -1
  65. data/spec/cassettes/Tacokit_Client_Cards/_add_label/adds_label_to_card.json +0 -1
  66. data/spec/cassettes/Tacokit_Client_Cards/_add_member_to_card/adds_member_to_card.json +0 -1
  67. data/spec/cassettes/Tacokit_Client_Cards/_archive_card/archives_card.json +0 -1
  68. data/spec/cassettes/Tacokit_Client_Cards/_archive_card/restore_card.json +0 -1
  69. data/spec/cassettes/Tacokit_Client_Cards/_attachments/returns_an_attachment.json +0 -1
  70. data/spec/cassettes/Tacokit_Client_Cards/_attachments/returns_attachments.json +0 -1
  71. data/spec/cassettes/Tacokit_Client_Cards/_card/returns_a_card_by_card_resource.json +0 -1
  72. data/spec/cassettes/Tacokit_Client_Cards/_card/returns_a_card_by_id.json +0 -1
  73. data/spec/cassettes/Tacokit_Client_Cards/_card/returns_a_card_by_short_link.json +0 -1
  74. data/spec/cassettes/Tacokit_Client_Cards/_card_actions/returns_card_actions.json +0 -1
  75. data/spec/cassettes/Tacokit_Client_Cards/_card_board/returns_card_board.json +0 -1
  76. data/spec/cassettes/Tacokit_Client_Cards/_card_list/returns_a_list.json +0 -1
  77. data/spec/cassettes/Tacokit_Client_Cards/_card_members/returns_members.json +0 -1
  78. data/spec/cassettes/Tacokit_Client_Cards/_card_members/returns_members_voted.json +0 -1
  79. data/spec/cassettes/Tacokit_Client_Cards/_checklists/returns_check_item_states.json +0 -1
  80. data/spec/cassettes/Tacokit_Client_Cards/_checklists/returns_checklists.json +0 -1
  81. data/spec/cassettes/Tacokit_Client_Cards/_create_card/creates_a_card.json +0 -1
  82. data/spec/cassettes/Tacokit_Client_Cards/_create_card_attachment/attaches_external_url.json +0 -1
  83. data/spec/cassettes/Tacokit_Client_Cards/_create_card_attachment/uploads_local_file.json +0 -1
  84. data/spec/cassettes/Tacokit_Client_Cards/_delete_card/deletes_a_card.json +0 -1
  85. data/spec/cassettes/Tacokit_Client_Cards/_delete_comment/deletes_comment.json +0 -1
  86. data/spec/cassettes/Tacokit_Client_Cards/_move_card/moves_card_to_a_new_position.json +0 -1
  87. data/spec/cassettes/Tacokit_Client_Cards/_move_card/moves_card_to_another_board_list.json +0 -1
  88. data/spec/cassettes/Tacokit_Client_Cards/_move_card/moves_card_to_board.json +0 -1
  89. data/spec/cassettes/Tacokit_Client_Cards/_move_card/moves_card_to_list.json +0 -1
  90. data/spec/cassettes/Tacokit_Client_Cards/_move_card/raises_error_if_missing_options.json +0 -1
  91. data/spec/cassettes/Tacokit_Client_Cards/_start_checklist/adds_new_checklist_by_name.json +0 -1
  92. data/spec/cassettes/Tacokit_Client_Cards/_start_checklist/copies_a_checklist_by_id.json +0 -1
  93. data/spec/cassettes/Tacokit_Client_Cards/_stickers/returns_stickers.json +0 -1
  94. data/spec/cassettes/Tacokit_Client_Cards/_update_card/updates_a_card.json +0 -1
  95. data/spec/cassettes/Tacokit_Client_Cards/_update_checklist_item/updates_checklist_item.json +0 -1
  96. data/spec/cassettes/Tacokit_Client_Cards/_update_comment/updates_a_comment.json +0 -1
  97. data/spec/cassettes/Tacokit_Client_Cards/_vote/adds_a_member_s_vote_to_card.json +0 -1
  98. data/spec/cassettes/Tacokit_Client_Checklists/_check_items/adds_a_checklist_check_item.json +0 -1
  99. data/spec/cassettes/Tacokit_Client_Checklists/_check_items/retrieves_checklist_check_items.json +0 -1
  100. data/spec/cassettes/Tacokit_Client_Checklists/_checklist/returns_a_checklist_by_id.json +0 -1
  101. data/spec/cassettes/Tacokit_Client_Checklists/_create_checklist/creates_a_checklist.json +0 -1
  102. data/spec/cassettes/Tacokit_Client_Checklists/_delete_checklist/deletes_a_checklist.json +0 -1
  103. data/spec/cassettes/Tacokit_Client_Checklists/_update_checklist/updates_a_checklist.json +0 -1
  104. data/spec/cassettes/Tacokit_Client_Labels/_create_label/creates_a_label.json +0 -1
  105. data/spec/cassettes/Tacokit_Client_Labels/_delete_label/deletes_a_label.json +0 -1
  106. data/spec/cassettes/Tacokit_Client_Labels/_label/returns_a_label_by_id.json +0 -1
  107. data/spec/cassettes/Tacokit_Client_Labels/_update_label/updates_a_label.json +0 -1
  108. data/spec/cassettes/Tacokit_Client_Lists/_archive_list_cards/should_archive_cards_in_list.json +0 -1
  109. data/spec/cassettes/Tacokit_Client_Lists/_create_list/creates_a_list.json +0 -1
  110. data/spec/cassettes/Tacokit_Client_Lists/_list/returns_a_list_by_id.json +0 -1
  111. data/spec/cassettes/Tacokit_Client_Lists/_list_actions/returns_list_actions.json +0 -1
  112. data/spec/cassettes/Tacokit_Client_Lists/_list_board/returns_list_board.json +0 -1
  113. data/spec/cassettes/Tacokit_Client_Lists/_list_cards/returns_list_cards.json +0 -1
  114. data/spec/cassettes/Tacokit_Client_Lists/_move_list_cards/should_move_cards_in_list.json +0 -1
  115. data/spec/cassettes/Tacokit_Client_Lists/_update_list/updates_a_list.json +0 -1
  116. data/spec/cassettes/Tacokit_Client_Members/_actions/returns_member_actions.json +0 -1
  117. data/spec/cassettes/Tacokit_Client_Members/_boards/returns_for_me_with_options_as_first_arg.json +0 -1
  118. data/spec/cassettes/Tacokit_Client_Members/_boards/returns_member_boards.json +0 -1
  119. data/spec/cassettes/Tacokit_Client_Members/_cards/returns_member_cards.json +0 -1
  120. data/spec/cassettes/Tacokit_Client_Members/_member/accepts_a_resource.json +0 -1
  121. data/spec/cassettes/Tacokit_Client_Members/_member/authenticated/returns_self.json +0 -1
  122. data/spec/cassettes/Tacokit_Client_Members/_member/returns_a_member.json +0 -1
  123. data/spec/cassettes/Tacokit_Client_Members/_member/returns_self.json +0 -1
  124. data/spec/cassettes/Tacokit_Client_Members/_member/supports_query_fields_as_string_or_array.json +0 -1
  125. data/spec/cassettes/Tacokit_Client_Members/_notifications/returns_member_notifications.json +0 -1
  126. data/spec/cassettes/Tacokit_Client_Members/_organizations/returns_member_organizations.json +0 -1
  127. data/spec/cassettes/Tacokit_Client_Members/_tokens/returns_member_tokens.json +0 -1
  128. data/spec/cassettes/Tacokit_Client_Members/_update_member/updates_a_member.json +0 -1
  129. data/spec/cassettes/Tacokit_Client_Members/_update_member/updates_nested_resource.json +0 -1
  130. data/spec/cassettes/Tacokit_Client_Notifications/_notification/returns_a_notification_by_id.json +0 -1
  131. data/spec/cassettes/Tacokit_Client_Notifications/_update_notification/updates_a_notification.json +0 -1
  132. data/spec/cassettes/Tacokit_Client_Organizations/_create_organization/creates_a_organization.json +0 -1
  133. data/spec/cassettes/Tacokit_Client_Organizations/_delete_organization/deletes_a_organization.json +0 -1
  134. data/spec/cassettes/Tacokit_Client_Organizations/_organization/returns_an_organization_by_id.json +0 -1
  135. data/spec/cassettes/Tacokit_Client_Organizations/_organization_resource/returns_organization_actions.json +0 -1
  136. data/spec/cassettes/Tacokit_Client_Organizations/_organization_resource/returns_organization_boards.json +0 -1
  137. data/spec/cassettes/Tacokit_Client_Organizations/_organization_resource/returns_organization_members.json +0 -1
  138. data/spec/cassettes/Tacokit_Client_Organizations/_update_organization/updates_a_organization.json +0 -1
  139. data/spec/cassettes/Tacokit_Client_Searches/_search/returns_search_result.json +0 -1
  140. data/spec/cassettes/Tacokit_Client_Tokens/_delete_token/deletes_a_token.json +0 -1
  141. data/spec/cassettes/Tacokit_Client_Tokens/_token/returns_a_token_for_token_string.json +0 -1
  142. data/spec/cassettes/Tacokit_Client_Tokens/_token_resource/returns_token_member.json +0 -1
  143. data/spec/cassettes/Tacokit_Client_Tokens/_token_resource/returns_token_webhooks.json +0 -1
  144. data/spec/cassettes/Tacokit_Client_Types/_type/returns_a_type_by_id.json +0 -1
  145. data/spec/cassettes/Tacokit_Client_Webhooks/_create_webhook/creates_a_webhook.json +0 -1
  146. data/spec/cassettes/Tacokit_Client_Webhooks/_delete_webhook/deletes_a_webhook.json +0 -1
  147. data/spec/cassettes/Tacokit_Client_Webhooks/_update_webhook/updates_a_webhook.json +0 -1
  148. data/spec/cassettes/Tacokit_Client_Webhooks/_webhook/returns_a_webhook_by_short_link.json +0 -1
  149. data/spec/fixtures/taco.png +0 -0
  150. data/spec/spec_helper.rb +0 -171
  151. data/spec/tacokit/authorization_spec.rb +0 -47
  152. data/spec/tacokit/client/actions_spec.rb +0 -137
  153. data/spec/tacokit/client/boards_spec.rb +0 -171
  154. data/spec/tacokit/client/cards_spec.rb +0 -446
  155. data/spec/tacokit/client/checklists_spec.rb +0 -89
  156. data/spec/tacokit/client/labels_spec.rb +0 -62
  157. data/spec/tacokit/client/lists_spec.rb +0 -131
  158. data/spec/tacokit/client/members_spec.rb +0 -145
  159. data/spec/tacokit/client/notifications_spec.rb +0 -25
  160. data/spec/tacokit/client/organizations_spec.rb +0 -79
  161. data/spec/tacokit/client/searches_spec.rb +0 -11
  162. data/spec/tacokit/client/tokens_spec.rb +0 -33
  163. data/spec/tacokit/client/types_spec.rb +0 -11
  164. data/spec/tacokit/client/webhooks_spec.rb +0 -61
  165. data/spec/tacokit/client_spec.rb +0 -28
  166. data/spec/tacokit/configuration_spec.rb +0 -50
  167. data/spec/tacokit/middleware/raise_error_spec.rb +0 -34
  168. data/spec/tacokit/resource_spec.rb +0 -151
  169. data/spec/tacokit/transform_spec.rb +0 -133
  170. data/spec/tacokit_spec.rb +0 -14
@@ -1,89 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Tacokit::Client::Checklists do
4
- def test_checklist_id
5
- "548ddd3f5402eb674035334f"
6
- end
7
-
8
- def test_card_id
9
- "548dd95c8ca25ac9d0d9ce71"
10
- end
11
-
12
- describe "#checklist", :vcr do
13
- it "returns a checklist by id" do
14
- checklist = app_client.checklist(test_checklist_id)
15
-
16
- expect(checklist.name).to eq "Test Checklist 1"
17
- end
18
- end
19
-
20
- describe "#update_checklist", :vcr do
21
- it "updates a checklist" do
22
- checklist = app_client.update_checklist test_checklist_id,
23
- name: "Test Checklist 1"
24
-
25
- expect(checklist.name).to eq "Test Checklist 1"
26
- assert_requested :put, trello_url_template("checklists/#{test_checklist_id}{?key,token}")
27
- end
28
- end
29
-
30
- describe "#check_items", :vcr do
31
- before do
32
- @card = app_client.create_card test_list_id, "Autocard", desc: "This is an autogenerated card"
33
- @checklist = app_client.start_checklist(@card.id, "Making a list")
34
- end
35
-
36
- it "retrieves checklist check items" do
37
- app_client.add_checklist_item(@checklist.id, "Test Checklist Item")
38
-
39
- check_items = app_client.check_items(@checklist.id)
40
-
41
- expect(check_items.size).to eq(1)
42
- expect(check_items.first.name).to eq("Test Checklist Item")
43
- end
44
-
45
- it "adds a checklist check item" do
46
- item = app_client.add_checklist_item(@checklist.id, "Test Checklist Item")
47
-
48
- expect(item.name).to eq("Test Checklist Item")
49
- end
50
-
51
- after do
52
- app_client.delete_card(@card.id)
53
- end
54
- end
55
-
56
- describe "#create_checklist", :vcr do
57
- before do
58
- @checklist = app_client.create_checklist test_card_id, "Autochecklist", pos: "top"
59
- end
60
-
61
- it "creates a checklist" do
62
- expect(@checklist.name).to eq "Autochecklist"
63
- expect(@checklist.pos).to be >= 1
64
- assert_requested :post, trello_url_template("checklists{?key,token}"),
65
- body: {
66
- "name" => "Autochecklist",
67
- "pos" => "top",
68
- "idCard" => test_card_id
69
- }
70
- end
71
-
72
- after do
73
- app_client.delete_checklist(@checklist.id)
74
- end
75
- end
76
-
77
- describe "#delete_checklist", :vcr do
78
- before do
79
- @checklist = app_client.create_checklist test_card_id, "Autochecklist"
80
- end
81
-
82
- it "deletes a checklist" do
83
- app_client.delete_checklist(@checklist.id)
84
-
85
- expect { app_client.checklist(@checklist.id) }.to raise_error(Tacokit::Error::ResourceNotFound)
86
- assert_requested :delete, trello_url_template("checklists/#{@checklist.id}{?key,token}")
87
- end
88
- end
89
- end
@@ -1,62 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Tacokit::Client::Labels do
4
- def test_label_id
5
- "548a675574d650d567d52ad0"
6
- end
7
-
8
- def test_board_id
9
- "548a675581d1d669c9e8184e"
10
- end
11
-
12
- describe "#label", :vcr do
13
- it "returns a label by id" do
14
- label = app_client.label(test_label_id)
15
- expect(label.name).to match(/Label/)
16
- end
17
- end
18
-
19
- describe "#update_label", :vcr do
20
- it "updates a label" do
21
- label = app_client.update_label test_label_id, name: "Test Label 1"
22
-
23
- expect(label.name).to eq "Test Label 1"
24
- assert_requested :put, trello_url_template("labels/#{test_label_id}{?key,token}")
25
- end
26
- end
27
-
28
- describe "#create_label", :vcr do
29
- before do
30
- @label = app_client.create_label test_board_id, "Test Label X", "sky"
31
- end
32
-
33
- it "creates a label" do
34
- expect(@label.name).to eq "Test Label X"
35
- expect(@label.color).to eq "sky"
36
-
37
- assert_requested :post, trello_url_template("labels{?key,token}"),
38
- body: {
39
- "idBoard" => test_board_id,
40
- "name" => "Test Label X",
41
- "color" => "sky"
42
- }
43
- end
44
-
45
- after do
46
- app_client.delete_label(@label.id)
47
- end
48
- end
49
-
50
- describe "#delete_label", :vcr do
51
- before do
52
- @label = app_client.create_label test_board_id, "Test Label X", "sky"
53
- end
54
-
55
- it "deletes a label" do
56
- app_client.delete_label(@label.id)
57
-
58
- assert_requested :delete, trello_url_template("labels/#{@label.id}{?key,token}")
59
- expect { app_client.label(@label.id) }.to raise_error(Tacokit::Error::ResourceNotFound)
60
- end
61
- end
62
- end
@@ -1,131 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Tacokit::Client::Lists do
4
- def test_list_id
5
- "548dd948ffd374221926b4c8"
6
- end
7
-
8
- def test_board_id
9
- "548a675581d1d669c9e8184e"
10
- end
11
-
12
- def test_alternate_list_id
13
- "54f3724e8a0bbe01a80f8712"
14
- end
15
-
16
- def test_alternate_board_id
17
- "54f371b4086781e1a71b6111"
18
- end
19
-
20
- describe "#list", :vcr do
21
- it "returns a list by id" do
22
- list = app_client.list(test_list_id)
23
-
24
- expect(list.name).to eq "List 1"
25
- end
26
- end
27
-
28
- describe "#list_actions", :vcr do
29
- it "returns list actions" do
30
- actions = app_client.list_actions(test_list_id)
31
-
32
- expect(actions).to be_any
33
- end
34
- end
35
-
36
- describe "#list_cards", :vcr do
37
- it "returns list cards" do
38
- cards = app_client.list_cards(test_list_id)
39
-
40
- expect(cards).to be_any
41
-
42
- card = cards.first
43
- expect(card.name).to be_present
44
- end
45
- end
46
-
47
- describe "#list_board", :vcr do
48
- it "returns list board" do
49
- board = app_client.list_board(test_list_id)
50
-
51
- expect(board.name).to be_present
52
- end
53
- end
54
-
55
- describe "#update_list", :vcr do
56
- it "updates a list" do
57
- list = app_client.update_list test_list_id, name: "Test List 1"
58
-
59
- expect(list.name).to eq "Test List 1"
60
- assert_requested :put, trello_url_template("lists/#{test_list_id}{?key,token}")
61
- end
62
-
63
- after do
64
- app_client.update_list test_list_id, name: "List 1"
65
- end
66
- end
67
-
68
- describe "#create_list", :vcr do
69
- before do
70
- @list = app_client.create_list test_board_id, "Autolist", pos: "bottom"
71
- end
72
-
73
- it "creates a list" do
74
- expect(@list.name).to eq "Autolist"
75
- expect(@list.pos).to be >= 1
76
- assert_requested :post, trello_url_template("lists{?key,token}"),
77
- body: {
78
- "name" => "Autolist",
79
- "pos" => "bottom",
80
- "idBoard" => test_board_id
81
- }
82
- end
83
-
84
- after do
85
- app_client.update_list @list.id, closed: true
86
- end
87
- end
88
-
89
- describe "#archive_list_cards", :vcr do
90
- before do
91
- @list = app_client.create_list test_board_id, "Autolist", pos: "bottom"
92
- @card = app_client.create_card @list.id, "Test card"
93
- end
94
-
95
- it "should archive cards in list" do
96
- app_client.archive_list_cards(@list.id)
97
-
98
- card = app_client.card(@card.id)
99
- expect(card.closed?).to be_truthy
100
- end
101
-
102
- after do
103
- app_client.update_list @list.id, closed: true
104
- end
105
- end
106
-
107
- describe "#move_list_cards", :vcr do
108
- before do
109
- @list = app_client.create_list test_board_id, "Autolist", pos: "bottom"
110
- @card = app_client.create_card @list.id, "Test card"
111
- end
112
-
113
- it "should move cards in list" do
114
- app_client.move_list_cards @list.id, test_alternate_list_id, test_alternate_board_id
115
-
116
- source = app_client.list_cards(@list.id)
117
- expect(source).to be_empty
118
-
119
- destination = app_client.list_cards(test_alternate_list_id)
120
- expect(destination.size).to eq(1)
121
-
122
- card = destination.first
123
- expect(card.list_id).to eq test_alternate_list_id
124
- end
125
-
126
- after do
127
- app_client.delete_card @card.id
128
- app_client.update_list @list.id, closed: true
129
- end
130
- end
131
- end
@@ -1,145 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Tacokit::Client::Members do
4
- describe "#member", :vcr do
5
- it "returns a member" do
6
- member = app_client.member("rossta")
7
-
8
- expect(member.username).to eq("rossta")
9
- assert_requested :get, trello_url_template("members/rossta{?key,token}")
10
- end
11
-
12
- it "returns self" do
13
- member = app_client.member
14
-
15
- expect(member.full_name).to eq("Taco Kit")
16
- end
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
-
26
- it "supports query fields as string or array" do
27
- member = app_client.member "tacokit",
28
- boards: "all",
29
- board_fields: "name,short_url",
30
- fields: %w[ username full_name ]
31
-
32
- expect(member.username).to eq("tacokit")
33
- expect(member.full_name).to eq("Taco Kit")
34
-
35
- board = member.boards.detect { |b| b.name =~ /^Test Board/ }
36
- expect(board.name).to eq("Test Board")
37
- expect(board.short_url).to match(%r{^https://trello.com})
38
- end
39
-
40
- context "authenticated" do
41
- it "returns self" do
42
- member = oauth_client.member
43
-
44
- expect(member.username).to eq("tacokit")
45
- expect(member.full_name).to eq("Taco Kit")
46
- assert_requested :get, trello_url("members/me")
47
- end
48
- end
49
- end
50
-
51
- describe "#actions", :vcr do
52
- it "returns member actions" do
53
- actions = app_client.actions("tacokit")
54
-
55
- expect(actions).not_to be_empty
56
-
57
- action = actions.first
58
- expect(action.member_creator.full_name).to be_present
59
-
60
- assert_requested :get, trello_url_template("members/tacokit/actions{?key,token,page}")
61
- end
62
- end
63
-
64
- describe "#boards", :vcr do
65
- it "returns member boards" do
66
- boards = app_client.boards("tacokit")
67
-
68
- expect(boards).not_to be_empty
69
-
70
- board = boards.first
71
- expect(board).to be_a(Tacokit::Resource)
72
- expect(board.name).to be_present
73
-
74
- assert_requested :get, trello_url_template("members/tacokit/boards{?key,token}")
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
85
- end
86
-
87
- describe "#cards", :vcr do
88
- it "returns member cards" do
89
- cards = app_client.cards("tacokit")
90
-
91
- expect(cards).to be_empty
92
-
93
- assert_requested :get, trello_url_template("members/tacokit/cards{?key,token}")
94
- end
95
- end
96
-
97
- describe "#notifications", :vcr do
98
- it "returns member notifications" do
99
- notifications = app_client.notifications("tacokit")
100
-
101
- expect(notifications).to be_empty
102
-
103
- assert_requested :get, trello_url_template("members/tacokit/notifications{?key,token,page}")
104
- end
105
- end
106
-
107
- describe "#organizations", :vcr do
108
- it "returns member organizations" do
109
- organizations = app_client.organizations("tacokit")
110
-
111
- expect(organizations).not_to be_empty
112
- org = organizations.first
113
- expect(org.name).to eq "teamtacokit"
114
-
115
- assert_requested :get, trello_url_template("members/tacokit/organizations{?key,token}")
116
- end
117
- end
118
-
119
- describe "#tokens", :vcr do
120
- it "returns member tokens" do
121
- tokens = app_client.tokens("tacokit")
122
-
123
- expect(tokens).not_to be_empty
124
- token = tokens.first
125
- expect(token.identifier).to be_present
126
-
127
- assert_requested :get, trello_url_template("members/tacokit/tokens{?key,token}")
128
- end
129
- end
130
-
131
- describe "#update_member", :vcr do
132
- it "updates a member" do
133
- member = oauth_client.update_member("tacokit", bio: "Tacokit puts the Trello API on Ruby")
134
-
135
- expect(member.bio).to eq "Tacokit puts the Trello API on Ruby"
136
- assert_requested :put, trello_url_template("members/tacokit{?key,token}")
137
- end
138
-
139
- it "updates nested resource" do
140
- member = oauth_client.update_member("tacokit", prefs: { color_blind: true })
141
-
142
- expect(member.prefs.color_blind).to eq true
143
- end
144
- end
145
- end
@@ -1,25 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Tacokit::Client::Notifications do
4
- # TODO: notifications disappear overtime... need to grab notification id dynamically
5
- def test_notification_id
6
- "549102431b607566bafc93ab"
7
- end
8
-
9
- pending "#notification", :vcr do
10
- it "returns a notification by id" do
11
- notification = app_client.notification(test_notification_id)
12
-
13
- expect(notification.data).to include(:text)
14
- end
15
- end
16
-
17
- pending "#update_notification", :vcr do
18
- it "updates a notification" do
19
- notification = oauth_client.update_notification(test_notification_id, unread: false)
20
-
21
- expect(notification.unread).to be false
22
- assert_requested :put, trello_url_template("notifications/#{test_notification_id}{?key,token}")
23
- end
24
- end
25
- end