cafe24_sms 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.mkd CHANGED
@@ -1,10 +1,9 @@
1
1
  Cafe24 SMS 발송 Ruby wrapper
2
2
  ==========================
3
- cafe24 sms 발송 서비스(유료) ruby wrapper. 필수 parameter를 넘겨서 sms 발송하는 기능만 있음(v. 0.0.1)
3
+ cafe24 sms 발송 서비스(유료) ruby wrapper. sms 발송하는 기능만 있음
4
4
 
5
5
  Installation
6
6
  ------------
7
- 아직 안 올림
8
7
 
9
8
  ``` sh
10
9
  gem install cafe24_sms
@@ -12,11 +11,12 @@ gem install cafe24_sms
12
11
 
13
12
  Usage
14
13
  -----
14
+
15
15
  ``` ruby
16
16
  require 'cafe24_sms'
17
17
 
18
18
  # sms 발송
19
- Cafe24.send_sms(:user_id => "user_id", :secure => "secure", :sphone1 => "011", :sphone2 => "9999", :sphone3 => "0000", :rphone => "011-9090-9090", :msg => "hello world!")
19
+ Cafe24Sms.send_sms(:user_id => "user_id", :secure => "secure", :sphone1 => "011", :sphone2 => "9999", :sphone3 => "0000", :rphone => "011-9090-9090", :msg => "hello world!")
20
20
 
21
21
 
22
22
  # 기본값 설정 가능
@@ -28,9 +28,9 @@ Cafe24Sms.configure do |config|
28
28
  config.sphone3 = "0000"
29
29
  end
30
30
 
31
- Cafe24.send_sms(:rphone => "011-9090-9090", :msg => "hello world!")
31
+ Cafe24Sms.send_sms(:rphone => "011-9090-9090", :msg => "hello world!")
32
32
 
33
33
 
34
- # 예약 발송
35
- Cafe24.send_sms(:rphone => "011-9090-9090", :msg => "hello world!", :rdate => "20110501", :rtime => "173000")
34
+ # 예약 발송(2011년 5월 1일, 17시 30분)
35
+ Cafe24Sms.send_sms(:rphone => "011-9090-9090", :msg => "hello world!", :rdate => "20110501", :rtime => "173000")
36
36
  ```
@@ -1,6 +1,8 @@
1
1
  module Cafe24Sms
2
2
  module Configuration
3
3
  SMS_URL = "https://sslsms.cafe24.com/sms_sender.php"
4
+ SMS_REMAIN_URL = "http://sslsms.cafe24.com/sms_remain.php"
5
+
4
6
  attr_accessor :user_id, :secure, :sphone1, :sphone2, :sphone3
5
7
 
6
8
  # Convenience method to allow configuration options to be set in a block
@@ -11,8 +11,6 @@ module Cafe24Sms
11
11
  http_session = Net::HTTP.new(url.host, url.port)
12
12
  http_session.use_ssl = true
13
13
  http_session.start {|http| http.request(req)}
14
-
15
- # Net::HTTP.post_form(URI.parse(Configuration::SMS_URL), _form_data(options))
16
14
  end
17
15
 
18
16
  def _form_data(options)
@@ -24,5 +22,10 @@ module Cafe24Sms
24
22
  :sphone3 => self.sphone3
25
23
  }.merge(options)
26
24
  end
25
+
26
+ def remaining_sms
27
+ auth_data = {:user_id => self.user_id, :secure => self.secure}
28
+ Net::HTTP.post_form(URI.parse(Configuration::SMS_REMAIN_URL), auth_data)
29
+ end
27
30
  end
28
31
  end
@@ -1,3 +1,3 @@
1
1
  module Cafe24Sms
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -22,6 +22,7 @@ end
22
22
  describe Cafe24Sms, ".send" do
23
23
  before :each do
24
24
  stub_request(:post, Cafe24Sms::Configuration::SMS_URL)
25
+ stub_request(:post, Cafe24Sms::Configuration::SMS_REMAIN_URL)
25
26
  end
26
27
 
27
28
  it 'should generate form_data with essential data' do
@@ -44,4 +45,10 @@ describe Cafe24Sms, ".send" do
44
45
  WebMock.should have_requested(:post, Cafe24Sms::Configuration::SMS_URL)
45
46
  .with(:body => "sms_url=https%3a%2f%2fsslsms.cafe24.com%2fsms_sender.php&user_id=boribook&secure=__my_secure__&sphone1=011&sphone2=0000&sphone3=0001&rphone=011-9988-9988&msg=hello%20world")
46
47
  end
48
+
49
+ it 'should check remaining sms count' do
50
+ Cafe24Sms.remaining_sms
51
+ WebMock.should have_requested(:post, Cafe24Sms::Configuration::SMS_REMAIN_URL)
52
+ .with(:body => "user_id=boribook&secure=__my_secure__")
53
+ end
47
54
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cafe24_sms
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - bayja
@@ -10,8 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-01 00:00:00 +09:00
14
- default_executable:
13
+ date: 2011-06-14 00:00:00 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: rspec
@@ -68,7 +67,6 @@ files:
68
67
  - lib/cafe24_sms/version.rb
69
68
  - spec/cafe24_sms_spec.rb
70
69
  - spec/spec_helper.rb
71
- has_rdoc: true
72
70
  homepage: ""
73
71
  licenses: []
74
72
 
@@ -92,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
90
  requirements: []
93
91
 
94
92
  rubyforge_project: cafe24_sms
95
- rubygems_version: 1.5.0
93
+ rubygems_version: 1.7.2
96
94
  signing_key:
97
95
  specification_version: 3
98
96
  summary: "\xEC\xB9\xB4\xED\x8E\x9824 sms \xEC\x82\xAC\xEC\x9A\xA9\xEC\x9D\x84 \xEC\x9C\x84\xED\x95\x9C gem"