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,133 +0,0 @@
1
- require "spec_helper"
2
-
3
- module Tacokit
4
- describe Transform do
5
- subject(:transform) { Transform.new }
6
-
7
- describe "#serialize" do
8
- def process(body)
9
- transform.serialize(body)
10
- end
11
-
12
- it "does not change no body" do
13
- result = process(nil)
14
- expect(result).to be_nil
15
- end
16
-
17
- it "does not change empty body" do
18
- result = process("")
19
- expect(result).to eq ""
20
- end
21
-
22
- it "does not change string body" do
23
- result = process("{a: 1}")
24
- expect(result).to eq "{a: 1}"
25
- end
26
-
27
- it "does not change empty hash body" do
28
- result = process({})
29
- expect(result).to eq({})
30
- end
31
-
32
- context "hash body" do
33
- it "it stringifies keys" do
34
- result = process(hello: "world")
35
-
36
- expect(result).to eq "hello" => "world"
37
- end
38
-
39
- it "lower camelizes keys" do
40
- result = process(hello_world: "hello_world", biggie_smalls: "biggie_smalls")
41
-
42
- expect(result).to include("helloWorld" => "hello_world")
43
- expect(result).to include("biggieSmalls" => "biggie_smalls")
44
- end
45
-
46
- it "flattens nested keys" do
47
- result = process(prefs: { "showSidebar" => true })
48
-
49
- expect(result).to eq("prefs/showSidebar" => true)
50
- end
51
-
52
- it "coverts id suffix to prefix" do
53
- result = process("card_id" => "a" * 10)
54
-
55
- expect(result).to eq("idCard" => "a" * 10)
56
- end
57
-
58
- it "coverts ids suffix to prefix and pluralizes" do
59
- result = process("card_ids" => "a" * 10)
60
-
61
- expect(result).to eq("idCards" => "a" * 10)
62
- end
63
-
64
- describe "special cases" do
65
- it "callbackURL" do
66
- result = process(callback_url: "http://example.com")
67
-
68
- expect(result).to eq("callbackURL" => "http://example.com")
69
- end
70
-
71
- it "idChecklistSource" do
72
- result = process("checklist_source_id" => "a" * 10)
73
-
74
- expect(result).to eq("idChecklistSource" => "a" * 10)
75
- end
76
- end
77
- end
78
- end
79
-
80
- describe "#deserialize" do
81
- def process(body)
82
- transform.deserialize(body)
83
- end
84
-
85
- it "does not change no body" do
86
- result = process(nil)
87
- expect(result).to be_nil
88
- end
89
-
90
- it "does not change empty body" do
91
- result = process("")
92
- expect(result).to eq ""
93
- end
94
-
95
- it "does not change string body" do
96
- result = process("{a: 1}")
97
- expect(result).to eq "{a: 1}"
98
- end
99
-
100
- it "does not change empty hash body" do
101
- result = process({})
102
- expect(result).to eq({})
103
- end
104
-
105
- context "hash body" do
106
- it "it stringifies keys" do
107
- result = process(hello: "world")
108
-
109
- expect(result).to eq "hello" => "world"
110
- end
111
-
112
- it "underscores keys" do
113
- result = process(helloWorld: "helloWorld", biggieSmalls: "biggieSmalls")
114
-
115
- expect(result).to include("hello_world" => "helloWorld")
116
- expect(result).to include("biggie_smalls" => "biggieSmalls")
117
- end
118
-
119
- it "coverts id prefix to suffix" do
120
- result = process("idCard" => "a" * 10, "idBoardPinned" => "123")
121
-
122
- expect(result).to eq("card_id" => "a" * 10, "board_pinned_id" => "123")
123
- end
124
-
125
- it "coverts ids suffix to prefix and pluralizes" do
126
- result = process("idCards" => "a" * 10, "idBoardsPinned" => ["123"])
127
-
128
- expect(result).to eq("card_ids" => "a" * 10, "boards_pinned_ids" => ["123"])
129
- end
130
- end
131
- end
132
- end
133
- end
@@ -1,14 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Tacokit do
4
- describe "#method_missing" do
5
- it "forwards messages to client" do
6
- expect(Tacokit.client).to receive(:get_app_key)
7
- Tacokit.get_app_key
8
- end
9
-
10
- it "raises otherwise" do
11
- expect { Tacokit.no_method }.to raise_error(NoMethodError)
12
- end
13
- end
14
- end