trails 1.0.5 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ === 1.1.0 / 2010-03-14
2
+
3
+ Twilio's SMS API has changed since the beta release (no url specified for handling sms responses).
4
+ * Update the send_sms call to reflect that (backwards-incompatible change)
5
+ * Start cleaning up the documentation a bit.
6
+
1
7
  === 1.0.5 / 2010-03-06
2
8
 
3
9
  * Ugh. accidentally released with unchecked-in code. undoing.
data/bin/trails CHANGED
@@ -0,0 +1 @@
1
+
data/lib/trails.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Trails
2
- VERSION = '1.0.5'
2
+ VERSION = '1.1.0'
3
3
  end
4
4
  begin
5
5
  TwilioRest
@@ -35,38 +35,44 @@ module Trails
35
35
  return true
36
36
  end
37
37
 
38
- # Make outgoing calls.
38
+ # Make outgoing calls:
39
+ # Required:
40
+ # - number
41
+ # - handler_url
42
+ #
43
+ # Options:
44
+ # - :caller
45
+ # - :method
46
+ # - :timeout
39
47
  def call( number, handler_url, opts = {} )
40
48
  params = {
41
- 'Caller' => opts['Caller'],
49
+ 'Caller' => opts['Caller'] || opts[:caller],
42
50
  'Called' => number,
43
51
  'Url' => handler_url,
44
- 'Method' => opts['Method'] || 'GET',
45
- 'Timeout' => opts['Timeout'] || 15
52
+ 'Method' => opts['Method'] || opts[:method] || 'GET',
53
+ 'Timeout' => opts['Timeout'] || opts[:timeout] || 15
46
54
  }
47
55
  api_version = opts[:api_version] || '2008-08-01'
48
- logger.debug( "Calling twlio with params: #{params.inspect}" )
49
56
  make_request( File.join( base_uri, 'Calls' ), 'POST', params )
50
57
  end
51
58
 
52
- # still a WIP:
53
- # number: to
54
- # body: text
55
- # url : response url
56
- # opts:
57
- # :from => number
58
- # :method => GET/POST
59
59
  MAX_SMS_LENGTH = 160
60
- def send_sms( number, body, url, opts = {} )
60
+ # Required:
61
+ # - number: to
62
+ # - body: text
63
+ #
64
+ # Options:
65
+ # - :from: number
66
+ # - :method: GET/POST
67
+ #
68
+ def send_sms( number, body, opts = {} )
61
69
  params = {
62
70
  'From' => opts[:from] || @config[:default_number],
63
71
  'To' => number,
64
72
  'Body' => body,
65
- 'Url' => url,
66
73
  'Method' => opts[:method] || 'POST'
67
74
  }
68
75
  url = File.join( base_uri, 'SMS/Messages' )
69
- logger.debug{ "Calling #{url} with #{params.inspect}" }
70
76
  make_request(url, 'POST', params )
71
77
  end
72
78
 
@@ -105,6 +111,7 @@ module Trails
105
111
  # having to worry about where credentials come from and stuff.
106
112
  def make_request( *args )
107
113
  @twilio_account ||= TwilioRest::Account.new( @sid, @token )
114
+ logger.debug{ "making twilio request with #{args.inspect}" }
108
115
  @twilio_account.request( *args )
109
116
  end
110
117
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hemant Bhanoo
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-13 00:00:00 -08:00
12
+ date: 2010-03-13 23:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 2.0.3
23
+ version: 2.0.4
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: gemcutter