factor-connector-trello 0.0.1
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.
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'factor-connector-api'
|
2
|
+
require 'trello'
|
3
|
+
|
4
|
+
Factor::Connector.service 'trello_boards' do
|
5
|
+
action 'create_board' do |params|
|
6
|
+
|
7
|
+
name = params['name']
|
8
|
+
api_key = params['api_key']
|
9
|
+
auth_token = params['auth_token']
|
10
|
+
|
11
|
+
fail 'A board name is required' unless name
|
12
|
+
|
13
|
+
info 'Initializing connection to Trello'
|
14
|
+
begin
|
15
|
+
Trello.configure do |config|
|
16
|
+
config.developer_public_key = api_key
|
17
|
+
config.member_token = auth_token
|
18
|
+
end
|
19
|
+
rescue
|
20
|
+
fail 'Authentication invalid'
|
21
|
+
end
|
22
|
+
|
23
|
+
info 'Creating new board'
|
24
|
+
begin
|
25
|
+
board = Trello::Board.create(name)
|
26
|
+
rescue
|
27
|
+
'Failed to create board'
|
28
|
+
end
|
29
|
+
|
30
|
+
action_callback board
|
31
|
+
end
|
32
|
+
action 'find_board' do |params|
|
33
|
+
|
34
|
+
board_id = params['board_id']
|
35
|
+
api_key = params['api_key']
|
36
|
+
auth_token = params['auth_token']
|
37
|
+
|
38
|
+
fail 'A board board ID is required' unless board_id
|
39
|
+
|
40
|
+
info 'Initializing connection to Trello'
|
41
|
+
begin
|
42
|
+
Trello.configure do |config|
|
43
|
+
config.developer_public_key = api_key
|
44
|
+
config.member_token = auth_token
|
45
|
+
end
|
46
|
+
rescue
|
47
|
+
fail 'Authentication invalid'
|
48
|
+
end
|
49
|
+
|
50
|
+
info 'Finding board'
|
51
|
+
begin
|
52
|
+
board = Trello::Board.find(board_id)
|
53
|
+
rescue
|
54
|
+
'Failed to find board'
|
55
|
+
end
|
56
|
+
|
57
|
+
action_callback board
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
require 'factor-connector-api'
|
2
|
+
require 'trello'
|
3
|
+
|
4
|
+
Factor::Connector.service 'trello_cards' do
|
5
|
+
action 'create_card' do |params|
|
6
|
+
|
7
|
+
list_id = params['list_id']
|
8
|
+
name = params['name']
|
9
|
+
api_key = params['api_key']
|
10
|
+
auth_token = params['auth_token']
|
11
|
+
|
12
|
+
fail 'List identification is required' unless list_id
|
13
|
+
fail 'A card name is required' unless name
|
14
|
+
|
15
|
+
content = {
|
16
|
+
list_id: list_id,
|
17
|
+
name: name
|
18
|
+
}
|
19
|
+
|
20
|
+
info 'Initializing connection to Trello'
|
21
|
+
begin
|
22
|
+
Trello.configure do |config|
|
23
|
+
config.developer_public_key = api_key
|
24
|
+
config.member_token = auth_token
|
25
|
+
end
|
26
|
+
rescue
|
27
|
+
fail 'Authentication invalid'
|
28
|
+
end
|
29
|
+
|
30
|
+
info 'Creating new card'
|
31
|
+
begin
|
32
|
+
card = Trello::Card.create(content)
|
33
|
+
rescue
|
34
|
+
'Failed to create card'
|
35
|
+
end
|
36
|
+
|
37
|
+
action_callback card
|
38
|
+
end
|
39
|
+
|
40
|
+
action 'find_card' do |params|
|
41
|
+
|
42
|
+
card_id = params['card_id']
|
43
|
+
list_id = params['list_id']
|
44
|
+
board_id = params['board_id']
|
45
|
+
member_id = params['member_id']
|
46
|
+
api_key = params['api_key']
|
47
|
+
auth_token = params['auth_token']
|
48
|
+
|
49
|
+
fail 'Card, list, board or member identification is required' unless card_id || list_id || board_id || member_id
|
50
|
+
|
51
|
+
info 'Initializing connection to Trello'
|
52
|
+
begin
|
53
|
+
Trello.configure do |config|
|
54
|
+
config.developer_public_key = api_key
|
55
|
+
config.member_token = auth_token
|
56
|
+
end
|
57
|
+
rescue
|
58
|
+
fail 'Authentication invalid'
|
59
|
+
end
|
60
|
+
|
61
|
+
info 'Finding card'
|
62
|
+
begin
|
63
|
+
cards = if card_id
|
64
|
+
Trello::Card.find(card_id)
|
65
|
+
elsif list_id
|
66
|
+
list = Trello::List.find(list_id)
|
67
|
+
list.cards
|
68
|
+
elsif board_id
|
69
|
+
board = Trello::Board.find(board_id)
|
70
|
+
board.cards
|
71
|
+
elsif member_id
|
72
|
+
member = Trello::Member.find(member_id)
|
73
|
+
member.cards
|
74
|
+
end
|
75
|
+
rescue
|
76
|
+
fail 'Failed to find specified card'
|
77
|
+
end
|
78
|
+
|
79
|
+
action_callback cards
|
80
|
+
end
|
81
|
+
|
82
|
+
action 'move_card' do |params|
|
83
|
+
|
84
|
+
card_id = params['card_id']
|
85
|
+
list_two_id = params['list_two_id']
|
86
|
+
api_key = params['api_key']
|
87
|
+
auth_token = params['auth_token']
|
88
|
+
|
89
|
+
fail 'Card identification is required' unless card_id
|
90
|
+
fail 'List identification is required' unless list_two_id
|
91
|
+
|
92
|
+
info 'Initializing connection to Trello'
|
93
|
+
begin
|
94
|
+
Trello.configure do |config|
|
95
|
+
config.developer_public_key = api_key
|
96
|
+
config.member_token = auth_token
|
97
|
+
end
|
98
|
+
rescue
|
99
|
+
fail 'Authentication invalid'
|
100
|
+
end
|
101
|
+
|
102
|
+
info 'Moving card'
|
103
|
+
begin
|
104
|
+
card = Trello::Card.find(card_id)
|
105
|
+
moved_card = card.move_to_list(list_two_id)
|
106
|
+
rescue
|
107
|
+
fail 'Failed to move card'
|
108
|
+
end
|
109
|
+
|
110
|
+
action_callback moved_card
|
111
|
+
end
|
112
|
+
|
113
|
+
action 'delete_card' do |params|
|
114
|
+
|
115
|
+
card_id = params['card_id']
|
116
|
+
api_key = params['api_key']
|
117
|
+
auth_token = params['auth_token']
|
118
|
+
|
119
|
+
fail 'Card identification is required' unless card_id
|
120
|
+
|
121
|
+
info 'Initializing connection to Trello'
|
122
|
+
begin
|
123
|
+
Trello.configure do |config|
|
124
|
+
config.developer_public_key = api_key
|
125
|
+
config.member_token = auth_token
|
126
|
+
end
|
127
|
+
rescue
|
128
|
+
fail 'Authentication invalid'
|
129
|
+
end
|
130
|
+
|
131
|
+
info 'Deleting card'
|
132
|
+
begin
|
133
|
+
card = Trello::Card.find(card_id)
|
134
|
+
response = card.delete
|
135
|
+
rescue
|
136
|
+
fail 'Failed to delete card'
|
137
|
+
end
|
138
|
+
|
139
|
+
action_callback response
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'factor-connector-api'
|
2
|
+
require 'trello'
|
3
|
+
|
4
|
+
Factor::Connector.service 'trello_lists' do
|
5
|
+
action 'create_list' do |params|
|
6
|
+
|
7
|
+
board_id = params['board_id']
|
8
|
+
name = params['name']
|
9
|
+
api_key = params['api_key']
|
10
|
+
auth_token = params['auth_token']
|
11
|
+
|
12
|
+
fail 'Board identification is required' unless board_id
|
13
|
+
fail 'A list name is required' unless name
|
14
|
+
|
15
|
+
content = {
|
16
|
+
board_id: board_id,
|
17
|
+
name: name
|
18
|
+
}
|
19
|
+
|
20
|
+
info 'Initializing connection to Trello'
|
21
|
+
begin
|
22
|
+
Trello.configure do |config|
|
23
|
+
config.developer_public_key = api_key
|
24
|
+
config.member_token = auth_token
|
25
|
+
end
|
26
|
+
rescue
|
27
|
+
fail 'Authentication invalid'
|
28
|
+
end
|
29
|
+
|
30
|
+
info 'Creating new list'
|
31
|
+
begin
|
32
|
+
list = Trello::List.create(content)
|
33
|
+
rescue
|
34
|
+
'Failed to create list'
|
35
|
+
end
|
36
|
+
|
37
|
+
action_callback list
|
38
|
+
end
|
39
|
+
|
40
|
+
action 'find_list' do |params|
|
41
|
+
|
42
|
+
list_id = params['list_id']
|
43
|
+
api_key = params['api_key']
|
44
|
+
auth_token = params['auth_token']
|
45
|
+
|
46
|
+
fail 'List identification is required' unless list_id
|
47
|
+
|
48
|
+
info 'Initializing connection to Trello'
|
49
|
+
begin
|
50
|
+
Trello.configure do |config|
|
51
|
+
config.developer_public_key = api_key
|
52
|
+
config.member_token = auth_token
|
53
|
+
end
|
54
|
+
rescue
|
55
|
+
fail 'Authentication invalid'
|
56
|
+
end
|
57
|
+
|
58
|
+
info 'Retrieving list information'
|
59
|
+
begin
|
60
|
+
list = Trello::List.find(list_id)
|
61
|
+
rescue
|
62
|
+
fail 'Failed to find specified list'
|
63
|
+
end
|
64
|
+
|
65
|
+
action_callback list
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'factor-connector-api'
|
2
|
+
require 'trello'
|
3
|
+
|
4
|
+
Factor::Connector.service 'trello_members' do
|
5
|
+
action 'find_member' do |params|
|
6
|
+
|
7
|
+
member_id = params['member_id'] # username or ID
|
8
|
+
board_id = params['board_id'] # link ID or ID
|
9
|
+
card_id = params['card_id']
|
10
|
+
api_key = params['api_key']
|
11
|
+
auth_token = params['auth_token']
|
12
|
+
|
13
|
+
fail 'A member ID, card ID or board ID is required' unless member_id || card_id || board_id
|
14
|
+
|
15
|
+
info 'Initializing connection to Trello'
|
16
|
+
begin
|
17
|
+
Trello.configure do |config|
|
18
|
+
config.developer_public_key = api_key
|
19
|
+
config.member_token = auth_token
|
20
|
+
end
|
21
|
+
rescue
|
22
|
+
fail 'Authentication invalid'
|
23
|
+
end
|
24
|
+
|
25
|
+
info 'Finding member'
|
26
|
+
begin
|
27
|
+
members = if member_id
|
28
|
+
Trello::Member.find(member_id)
|
29
|
+
elsif board_id
|
30
|
+
board = Trello::Board.find(board_id)
|
31
|
+
board.members
|
32
|
+
elsif card_id
|
33
|
+
card = Trello::Card.find(card_id)
|
34
|
+
card.members
|
35
|
+
end
|
36
|
+
rescue
|
37
|
+
fail 'Failed to find member'
|
38
|
+
end
|
39
|
+
|
40
|
+
action_callback members
|
41
|
+
end
|
42
|
+
action 'add_member' do |params|
|
43
|
+
|
44
|
+
member_id = params['member_id'] # username or ID
|
45
|
+
card_id = params['card_id']
|
46
|
+
api_key = params['api_key']
|
47
|
+
auth_token = params['auth_token']
|
48
|
+
|
49
|
+
fail 'A member ID is required' unless member_id
|
50
|
+
fail 'A card ID is required' unless card_id
|
51
|
+
|
52
|
+
info 'Initializing connection to Trello'
|
53
|
+
begin
|
54
|
+
Trello.configure do |config|
|
55
|
+
config.developer_public_key = api_key
|
56
|
+
config.member_token = auth_token
|
57
|
+
end
|
58
|
+
rescue
|
59
|
+
fail 'Authentication invalid'
|
60
|
+
end
|
61
|
+
|
62
|
+
info 'Adding member to card'
|
63
|
+
begin
|
64
|
+
card = Trello::Card.find(card_id)
|
65
|
+
board = card.board
|
66
|
+
member = Trello::Member.find(member_id)
|
67
|
+
update = if board.members.include? member
|
68
|
+
card.add_member(member)
|
69
|
+
else
|
70
|
+
board.add_member(member)
|
71
|
+
card.add_member(member)
|
72
|
+
end
|
73
|
+
rescue
|
74
|
+
fail 'Failed to add member'
|
75
|
+
end
|
76
|
+
|
77
|
+
action_callback update
|
78
|
+
end
|
79
|
+
end
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: factor-connector-trello
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Josie Wright
|
9
|
+
- Andrew Akers
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2014-10-15 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: factor-connector-api
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.0.13
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 0.0.13
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: codeclimate-test-reporter
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ~>
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 0.4.1
|
39
|
+
type: :development
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.4.1
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.1.0
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 3.1.0
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: rake
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ~>
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 10.3.2
|
71
|
+
type: :development
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ~>
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 10.3.2
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: wrong
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ~>
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 0.7.1
|
87
|
+
type: :development
|
88
|
+
prerelease: false
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ~>
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 0.7.1
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: ruby-trello
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ~>
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 1.1.1
|
103
|
+
type: :development
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.1.1
|
111
|
+
description:
|
112
|
+
email:
|
113
|
+
- jozwright@gmail.com
|
114
|
+
- andrewrdakers@gmail.com
|
115
|
+
executables: []
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- lib/factor/connector/trello_boards.rb
|
120
|
+
- lib/factor/connector/trello_cards.rb
|
121
|
+
- lib/factor/connector/trello_lists.rb
|
122
|
+
- lib/factor/connector/trello_members.rb
|
123
|
+
homepage: https://factor.io
|
124
|
+
licenses: []
|
125
|
+
post_install_message:
|
126
|
+
rdoc_options: []
|
127
|
+
require_paths:
|
128
|
+
- lib
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
131
|
+
requirements:
|
132
|
+
- - ! '>='
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
none: false
|
137
|
+
requirements:
|
138
|
+
- - ! '>='
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
requirements: []
|
142
|
+
rubyforge_project:
|
143
|
+
rubygems_version: 1.8.25
|
144
|
+
signing_key:
|
145
|
+
specification_version: 3
|
146
|
+
summary: Trello Factor.io Connector
|
147
|
+
test_files: []
|