tacokit 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +4 -0
- data/.travis.yml +3 -0
- data/Gemfile +2 -1
- data/README.md +140 -47
- data/Rakefile +13 -0
- data/bin/_guard-core +16 -0
- data/bin/console +14 -0
- data/bin/guard +16 -0
- data/bin/rake +16 -0
- data/bin/rspec +16 -0
- data/bin/rubocop +16 -0
- data/bin/setup +7 -0
- data/lib/tacokit/authorization.rb +8 -9
- data/lib/tacokit/client.rb +14 -20
- data/lib/tacokit/client/actions.rb +30 -14
- data/lib/tacokit/client/boards.rb +112 -16
- data/lib/tacokit/client/cards.rb +251 -72
- data/lib/tacokit/client/checklists.rb +25 -14
- data/lib/tacokit/client/labels.rb +11 -4
- data/lib/tacokit/client/lists.rb +66 -13
- data/lib/tacokit/client/members.rb +118 -42
- data/lib/tacokit/client/notifications.rb +29 -2
- data/lib/tacokit/client/organizations.rb +13 -5
- data/lib/tacokit/client/searches.rb +17 -2
- data/lib/tacokit/client/tokens.rb +8 -2
- data/lib/tacokit/client/types.rb +4 -2
- data/lib/tacokit/client/webhooks.rb +17 -4
- data/lib/tacokit/collection.rb +6 -5
- data/lib/tacokit/configuration.rb +10 -2
- data/lib/tacokit/middleware.rb +16 -0
- data/lib/tacokit/resource.rb +7 -6
- data/lib/tacokit/transform.rb +2 -4
- data/lib/tacokit/utils.rb +7 -4
- data/lib/tacokit/version.rb +2 -1
- data/tacokit.gemspec +4 -4
- metadata +17 -273
- data/spec/cassettes/Tacokit_Client/_connection/authorized_GET_request_with_app_key_and_token_params.json +0 -1
- data/spec/cassettes/Tacokit_Client_Actions/_action/returns_a_token_authorized_action.json +0 -1
- data/spec/cassettes/Tacokit_Client_Actions/_action/returns_oauth_authorized_board.json +0 -1
- data/spec/cassettes/Tacokit_Client_Actions/_action_board/returns_action_board.json +0 -1
- data/spec/cassettes/Tacokit_Client_Actions/_action_card/returns_action_card.json +0 -1
- data/spec/cassettes/Tacokit_Client_Actions/_action_entities/returns_action_entities.json +0 -1
- data/spec/cassettes/Tacokit_Client_Actions/_action_list/returns_action_list.json +0 -1
- data/spec/cassettes/Tacokit_Client_Actions/_delete_action/deletes_an_action.json +0 -1
- data/spec/cassettes/Tacokit_Client_Actions/_update_action/updates_an_action.json +0 -1
- data/spec/cassettes/Tacokit_Client_Actions/_update_action_text/updates_an_action.json +0 -1
- data/spec/cassettes/Tacokit_Client_Boards/_add_board_member/adds_invites_member_to_board.json +0 -1
- data/spec/cassettes/Tacokit_Client_Boards/_board/returns_a_token_authorized_board.json +0 -1
- data/spec/cassettes/Tacokit_Client_Boards/_board/returns_oauth_authorized_board.json +0 -1
- data/spec/cassettes/Tacokit_Client_Boards/_board_actions/returns_board_actions.json +0 -1
- data/spec/cassettes/Tacokit_Client_Boards/_board_cards/returns_board_cards.json +0 -1
- data/spec/cassettes/Tacokit_Client_Boards/_board_checklists/returns_board_checklists.json +0 -1
- data/spec/cassettes/Tacokit_Client_Boards/_board_labels/returns_board_labels.json +0 -1
- data/spec/cassettes/Tacokit_Client_Boards/_board_lists/returns_board_lists.json +0 -1
- data/spec/cassettes/Tacokit_Client_Boards/_board_members/returns_board_members.json +0 -1
- data/spec/cassettes/Tacokit_Client_Boards/_board_organization/returns_board_organization.json +0 -1
- data/spec/cassettes/Tacokit_Client_Boards/_board_preferences/returns_preferences_for_a_board.json +0 -1
- data/spec/cassettes/Tacokit_Client_Boards/_board_stars/returns_board_stars.json +0 -1
- data/spec/cassettes/Tacokit_Client_Boards/_update_board/updates_a_board.json +0 -1
- data/spec/cassettes/Tacokit_Client_Boards/_update_board/updates_nested_resource.json +0 -1
- data/spec/cassettes/Tacokit_Client_Boards/_update_board_member/updates_member.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_add_comment/creates_a_comment.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_add_label/adds_label_to_card.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_add_member_to_card/adds_member_to_card.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_archive_card/archives_card.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_archive_card/restore_card.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_attachments/returns_an_attachment.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_attachments/returns_attachments.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_card/returns_a_card_by_card_resource.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_card/returns_a_card_by_id.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_card/returns_a_card_by_short_link.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_card_actions/returns_card_actions.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_card_board/returns_card_board.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_card_list/returns_a_list.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_card_members/returns_members.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_card_members/returns_members_voted.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_checklists/returns_check_item_states.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_checklists/returns_checklists.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_create_card/creates_a_card.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_create_card_attachment/attaches_external_url.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_create_card_attachment/uploads_local_file.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_delete_card/deletes_a_card.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_delete_comment/deletes_comment.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_move_card/moves_card_to_a_new_position.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_move_card/moves_card_to_another_board_list.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_move_card/moves_card_to_board.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_move_card/moves_card_to_list.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_move_card/raises_error_if_missing_options.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_start_checklist/adds_new_checklist_by_name.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_start_checklist/copies_a_checklist_by_id.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_stickers/returns_stickers.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_update_card/updates_a_card.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_update_checklist_item/updates_checklist_item.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_update_comment/updates_a_comment.json +0 -1
- data/spec/cassettes/Tacokit_Client_Cards/_vote/adds_a_member_s_vote_to_card.json +0 -1
- data/spec/cassettes/Tacokit_Client_Checklists/_check_items/adds_a_checklist_check_item.json +0 -1
- data/spec/cassettes/Tacokit_Client_Checklists/_check_items/retrieves_checklist_check_items.json +0 -1
- data/spec/cassettes/Tacokit_Client_Checklists/_checklist/returns_a_checklist_by_id.json +0 -1
- data/spec/cassettes/Tacokit_Client_Checklists/_create_checklist/creates_a_checklist.json +0 -1
- data/spec/cassettes/Tacokit_Client_Checklists/_delete_checklist/deletes_a_checklist.json +0 -1
- data/spec/cassettes/Tacokit_Client_Checklists/_update_checklist/updates_a_checklist.json +0 -1
- data/spec/cassettes/Tacokit_Client_Labels/_create_label/creates_a_label.json +0 -1
- data/spec/cassettes/Tacokit_Client_Labels/_delete_label/deletes_a_label.json +0 -1
- data/spec/cassettes/Tacokit_Client_Labels/_label/returns_a_label_by_id.json +0 -1
- data/spec/cassettes/Tacokit_Client_Labels/_update_label/updates_a_label.json +0 -1
- data/spec/cassettes/Tacokit_Client_Lists/_archive_list_cards/should_archive_cards_in_list.json +0 -1
- data/spec/cassettes/Tacokit_Client_Lists/_create_list/creates_a_list.json +0 -1
- data/spec/cassettes/Tacokit_Client_Lists/_list/returns_a_list_by_id.json +0 -1
- data/spec/cassettes/Tacokit_Client_Lists/_list_actions/returns_list_actions.json +0 -1
- data/spec/cassettes/Tacokit_Client_Lists/_list_board/returns_list_board.json +0 -1
- data/spec/cassettes/Tacokit_Client_Lists/_list_cards/returns_list_cards.json +0 -1
- data/spec/cassettes/Tacokit_Client_Lists/_move_list_cards/should_move_cards_in_list.json +0 -1
- data/spec/cassettes/Tacokit_Client_Lists/_update_list/updates_a_list.json +0 -1
- data/spec/cassettes/Tacokit_Client_Members/_actions/returns_member_actions.json +0 -1
- data/spec/cassettes/Tacokit_Client_Members/_boards/returns_for_me_with_options_as_first_arg.json +0 -1
- data/spec/cassettes/Tacokit_Client_Members/_boards/returns_member_boards.json +0 -1
- data/spec/cassettes/Tacokit_Client_Members/_cards/returns_member_cards.json +0 -1
- data/spec/cassettes/Tacokit_Client_Members/_member/accepts_a_resource.json +0 -1
- data/spec/cassettes/Tacokit_Client_Members/_member/authenticated/returns_self.json +0 -1
- data/spec/cassettes/Tacokit_Client_Members/_member/returns_a_member.json +0 -1
- data/spec/cassettes/Tacokit_Client_Members/_member/returns_self.json +0 -1
- data/spec/cassettes/Tacokit_Client_Members/_member/supports_query_fields_as_string_or_array.json +0 -1
- data/spec/cassettes/Tacokit_Client_Members/_notifications/returns_member_notifications.json +0 -1
- data/spec/cassettes/Tacokit_Client_Members/_organizations/returns_member_organizations.json +0 -1
- data/spec/cassettes/Tacokit_Client_Members/_tokens/returns_member_tokens.json +0 -1
- data/spec/cassettes/Tacokit_Client_Members/_update_member/updates_a_member.json +0 -1
- data/spec/cassettes/Tacokit_Client_Members/_update_member/updates_nested_resource.json +0 -1
- data/spec/cassettes/Tacokit_Client_Notifications/_notification/returns_a_notification_by_id.json +0 -1
- data/spec/cassettes/Tacokit_Client_Notifications/_update_notification/updates_a_notification.json +0 -1
- data/spec/cassettes/Tacokit_Client_Organizations/_create_organization/creates_a_organization.json +0 -1
- data/spec/cassettes/Tacokit_Client_Organizations/_delete_organization/deletes_a_organization.json +0 -1
- data/spec/cassettes/Tacokit_Client_Organizations/_organization/returns_an_organization_by_id.json +0 -1
- data/spec/cassettes/Tacokit_Client_Organizations/_organization_resource/returns_organization_actions.json +0 -1
- data/spec/cassettes/Tacokit_Client_Organizations/_organization_resource/returns_organization_boards.json +0 -1
- data/spec/cassettes/Tacokit_Client_Organizations/_organization_resource/returns_organization_members.json +0 -1
- data/spec/cassettes/Tacokit_Client_Organizations/_update_organization/updates_a_organization.json +0 -1
- data/spec/cassettes/Tacokit_Client_Searches/_search/returns_search_result.json +0 -1
- data/spec/cassettes/Tacokit_Client_Tokens/_delete_token/deletes_a_token.json +0 -1
- data/spec/cassettes/Tacokit_Client_Tokens/_token/returns_a_token_for_token_string.json +0 -1
- data/spec/cassettes/Tacokit_Client_Tokens/_token_resource/returns_token_member.json +0 -1
- data/spec/cassettes/Tacokit_Client_Tokens/_token_resource/returns_token_webhooks.json +0 -1
- data/spec/cassettes/Tacokit_Client_Types/_type/returns_a_type_by_id.json +0 -1
- data/spec/cassettes/Tacokit_Client_Webhooks/_create_webhook/creates_a_webhook.json +0 -1
- data/spec/cassettes/Tacokit_Client_Webhooks/_delete_webhook/deletes_a_webhook.json +0 -1
- data/spec/cassettes/Tacokit_Client_Webhooks/_update_webhook/updates_a_webhook.json +0 -1
- data/spec/cassettes/Tacokit_Client_Webhooks/_webhook/returns_a_webhook_by_short_link.json +0 -1
- data/spec/fixtures/taco.png +0 -0
- data/spec/spec_helper.rb +0 -171
- data/spec/tacokit/authorization_spec.rb +0 -47
- data/spec/tacokit/client/actions_spec.rb +0 -137
- data/spec/tacokit/client/boards_spec.rb +0 -171
- data/spec/tacokit/client/cards_spec.rb +0 -446
- data/spec/tacokit/client/checklists_spec.rb +0 -89
- data/spec/tacokit/client/labels_spec.rb +0 -62
- data/spec/tacokit/client/lists_spec.rb +0 -131
- data/spec/tacokit/client/members_spec.rb +0 -145
- data/spec/tacokit/client/notifications_spec.rb +0 -25
- data/spec/tacokit/client/organizations_spec.rb +0 -79
- data/spec/tacokit/client/searches_spec.rb +0 -11
- data/spec/tacokit/client/tokens_spec.rb +0 -33
- data/spec/tacokit/client/types_spec.rb +0 -11
- data/spec/tacokit/client/webhooks_spec.rb +0 -61
- data/spec/tacokit/client_spec.rb +0 -28
- data/spec/tacokit/configuration_spec.rb +0 -50
- data/spec/tacokit/middleware/raise_error_spec.rb +0 -34
- data/spec/tacokit/resource_spec.rb +0 -151
- data/spec/tacokit/transform_spec.rb +0 -133
- 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
|
data/spec/tacokit_spec.rb
DELETED
@@ -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
|