moonshado-sms 0.2.1 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION.yml +1 -1
  2. data/lib/moonshado/sms.rb +7 -2
  3. metadata +3 -3
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- :minor: 2
2
+ :minor: 3
3
3
  :build:
4
4
  :patch: 1
5
5
  :major: 0
data/lib/moonshado/sms.rb CHANGED
@@ -7,11 +7,16 @@ module Moonshado
7
7
  cattr_accessor :config
8
8
  attr_accessor :number, :message
9
9
 
10
+ def self.url
11
+ @url ||= URI.parse(config[:sms_api_url])
12
+ "#{@url.scheme}://#{@url.user}:#{@url.password}@#{@url.host}:#{@url.port}/sms"
13
+ end
14
+
10
15
  def self.find(id)
11
16
  if config[:test_env] == true
12
17
  {:sms => {:id => id, :reports => '[{"update_date":"2010-01-03T22:56:45-08:00","status_info":"test"}]'}, :stat => "ok"}
13
18
  else
14
- response = RestClient.get("#{config[:sms_api_url]}/#{id}")
19
+ response = RestClient.get("#{url}/#{id}")
15
20
  JSON.parse(response.body)
16
21
  end
17
22
  end
@@ -28,7 +33,7 @@ module Moonshado
28
33
  {:stat => 'ok', :id => Digest::SHA1.hexdigest(Time.now.to_s + rand(12341234).to_s)[1..16]}
29
34
  else
30
35
  response = RestClient.post(
31
- config[:sms_api_url],
36
+ Moonshado::Sms.url,
32
37
  {:sms => {:device_address => format_number(@number), :message => @message}}
33
38
  )
34
39
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
7
+ - 3
8
8
  - 1
9
- version: 0.2.1
9
+ version: 0.3.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kevin Patel
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-28 00:00:00 -04:00
17
+ date: 2010-05-12 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency