factor-connector-trello 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,6 @@
1
1
  require 'factor-connector-api'
2
2
  require 'trello'
3
+ require 'rest-client'
3
4
 
4
5
  Factor::Connector.service 'trello_boards' do
5
6
  action 'create_board' do |params|
@@ -56,4 +57,32 @@ Factor::Connector.service 'trello_boards' do
56
57
 
57
58
  action_callback board
58
59
  end
60
+ action 'close_board' do |params|
61
+
62
+ board_id = params['board_id']
63
+ api_key = params['api_key']
64
+ auth_token = params['auth_token']
65
+
66
+ fail 'Board identification is required' unless board_id
67
+
68
+ info 'Initializing connection to Trello'
69
+ begin
70
+ Trello.configure do |config|
71
+ config.developer_public_key = api_key
72
+ config.member_token = auth_token
73
+ end
74
+ rescue
75
+ fail 'Authentication invalid'
76
+ end
77
+
78
+ info 'Closing board'
79
+ begin
80
+ board = Trello::Board.find(board_id)
81
+ response = RestClient.put("https://trello.com/1/boards/#{board.id}/closed?key=#{api_key}&token=#{auth_token}",value:true)
82
+ rescue
83
+ fail 'Failed to close board'
84
+ end
85
+
86
+ action_callback response
87
+ end
59
88
  end
@@ -1,5 +1,6 @@
1
1
  require 'factor-connector-api'
2
2
  require 'trello'
3
+ require 'rest-client'
3
4
 
4
5
  Factor::Connector.service 'trello_lists' do
5
6
  action 'create_list' do |params|
@@ -64,4 +65,32 @@ Factor::Connector.service 'trello_lists' do
64
65
 
65
66
  action_callback list
66
67
  end
68
+ action 'close_list' do |params|
69
+
70
+ list_id = params['list_id']
71
+ api_key = params['api_key']
72
+ auth_token = params['auth_token']
73
+
74
+ fail 'List identification is required' unless list_id
75
+
76
+ info 'Initializing connection to Trello'
77
+ begin
78
+ Trello.configure do |config|
79
+ config.developer_public_key = api_key
80
+ config.member_token = auth_token
81
+ end
82
+ rescue
83
+ fail 'Authentication invalid'
84
+ end
85
+
86
+ info 'Closing list'
87
+ begin
88
+ list = Trello::List.find(list_id)
89
+ response = RestClient.put("https://trello.com/1/lists/#{list.id}/closed?key=#{api_key}&token=#{auth_token}",value:true)
90
+ rescue
91
+ fail 'Failed to close list'
92
+ end
93
+
94
+ action_callback response
95
+ end
67
96
  end
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factor-connector-trello
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Josie Wright
9
- - Andrew Akers
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2014-10-15 00:00:00.000000000 Z
12
+ date: 2014-10-17 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: factor-connector-api
@@ -108,10 +107,25 @@ dependencies:
108
107
  - - ~>
109
108
  - !ruby/object:Gem::Version
110
109
  version: 1.1.1
110
+ - !ruby/object:Gem::Dependency
111
+ name: rest-client
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 1.6.7
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 1.6.7
111
126
  description:
112
127
  email:
113
128
  - jozwright@gmail.com
114
- - andrewrdakers@gmail.com
115
129
  executables: []
116
130
  extensions: []
117
131
  extra_rdoc_files: []