mtm 2.0.4 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/mtm/mtm.rb +7 -5
- data/lib/mtm/utils.rb +14 -16
- data/lib/mtm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZmMwZDI1MDQ5NTIxNTc2YzRhN2EwZjg1ZTUzMjhmZmI1MDJkYzU5Yg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NWMyZTYyOGMwNzY0ZjA5M2M2NWY1Nzg0MTU1MmQzMjI1ZGVjODNjMg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjI3NzA4NTM2NWU1ZTM0ZDI5MWY1Mjg2NWRlYWVhNWI1YzVmNzAzZDdjYTU2
|
10
|
+
YWZhZTE4MjhlYWQxM2UwYjI3NjU4ZDVjNzE1YzA2MmFkYTEwOTY2MjFhYzg3
|
11
|
+
YjI2MzZhYjEwODMzODU5ZTlkZjMyNzZhODY0NzkxNGI4YjJhMTQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjBmZTExMTQ2ZDU0YzQ5MjI3MzE2Yzg3NjEyOTllZTQxOTc3MTc4OWE2Y2Q2
|
14
|
+
NTdiM2U4MDM3Nzk3ZDdkMmJkNWNhNjk3MTFlMDRkYTU4OGYwMWFhYzMzNGRi
|
15
|
+
NTQ1ZmZiNGMzMTdjODQzZGJiODY2ZGNhMjY3NDI0YjFlOTRmNzQ=
|
data/lib/mtm/mtm.rb
CHANGED
@@ -3,7 +3,6 @@ require 'rubygems'
|
|
3
3
|
require 'restforce' # gem install restforce
|
4
4
|
require 'optparse/date'
|
5
5
|
require 'ruby-progressbar'
|
6
|
-
require 'twilio-ruby'
|
7
6
|
require 'utils'
|
8
7
|
require 'config'
|
9
8
|
|
@@ -29,9 +28,6 @@ options[:tm_description] = SF_TIMECARD_DESCRIPTION
|
|
29
28
|
sf_client_id = '3MVG9Y6d_Btp4xp6SWO6yPlUURnycVbOfuH7I_NH2bjaw0yeoguRatNzKRpEVaIvmX7TcQbVVjuQUCZ006pwN'
|
30
29
|
sf_client_secret = '5339957415407001741' # salesforce remote app client secret
|
31
30
|
user_name_suffix = '@pm.meginfo.com'
|
32
|
-
# twilio
|
33
|
-
account_sid = 'ACe81d15486c1f4568a9c981053bce307b'
|
34
|
-
auth_token = 'a502db99e86340c4967cb89f0714c4ce'
|
35
31
|
|
36
32
|
op = OptionParser.new do |opts|
|
37
33
|
opts.banner = <<-BANNER
|
@@ -205,7 +201,13 @@ else
|
|
205
201
|
end
|
206
202
|
|
207
203
|
if is_success
|
208
|
-
|
204
|
+
begin
|
205
|
+
Mtm.send_sms(MOBILE_NUMBER, projects.first.Name, options[:tm_hour], options[:tm_description])
|
206
|
+
rescue Exception => e
|
207
|
+
puts
|
208
|
+
puts e.message
|
209
|
+
abort 'Failed to send SMS to your mobile, please contact BruceYue to verify it!'
|
210
|
+
end
|
209
211
|
end
|
210
212
|
|
211
213
|
@pb.finish
|
data/lib/mtm/utils.rb
CHANGED
@@ -11,7 +11,7 @@ module Mtm
|
|
11
11
|
Date.parse(d)
|
12
12
|
end
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
# Creates time card
|
16
16
|
def create_timecard(*args, client)
|
17
17
|
client.create!('TimeCard__c', Project__c: args[0],
|
@@ -23,22 +23,20 @@ module Mtm
|
|
23
23
|
puts
|
24
24
|
puts "Timecrad created successfully. Hour: '#{args[3]}', Project: '#{args[6]}'"
|
25
25
|
end
|
26
|
-
|
27
|
-
def send_sms(
|
26
|
+
|
27
|
+
def send_sms(mobile, *args)
|
28
|
+
# twilio
|
29
|
+
account_sid = 'ACe81d15486c1f4568a9c981053bce307b'
|
30
|
+
auth_token = 'a502db99e86340c4967cb89f0714c4ce'
|
31
|
+
|
28
32
|
if !mobile.empty?
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
)
|
37
|
-
rescue Exception => e
|
38
|
-
puts
|
39
|
-
puts e.message
|
40
|
-
abort 'Failed to send SMS to your mobile, please contact BruceYue to verify it!'
|
41
|
-
end
|
33
|
+
# set up a client to talk to the Twilio REST API
|
34
|
+
@t_client = Twilio::REST::Client.new account_sid, auth_token
|
35
|
+
@t_client.account.sms.messages.create(
|
36
|
+
:from => '+19788000322',
|
37
|
+
:to => '+86' + mobile,
|
38
|
+
:body => "Project: #{args[0]}, Hours: #{args[1]}, Description: #{args[2]}"
|
39
|
+
)
|
42
40
|
end
|
43
41
|
end
|
44
42
|
|
data/lib/mtm/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mtm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruce Yue
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir:
|
10
10
|
- bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: restforce
|