magti 0.1.0.beta2 → 0.1.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/magti/sms.rb CHANGED
@@ -2,6 +2,7 @@
2
2
  require 'set'
3
3
  require 'cgi'
4
4
  require 'httparty'
5
+ require 'c12-commons'
5
6
 
6
7
  module Magti
7
8
  # Response object.
@@ -20,7 +21,7 @@ module Magti
20
21
  raise ArgumentError, 'illegal mobile number' unless C12.correct_mobile?(mobile)
21
22
  raise ArgumentError, 'max size exceeded' if text.length > Magti::MAX_SIZE
22
23
  options = Magti.config.security_options
23
- if options.nil? or options.empty? or !Set.new(options.keys).proper_subset?(Set[:username, :password, :client_id, :service_id])
24
+ if options.nil? or options.empty? or Set[:username, :password, :service_id, :client_id] != Set.new(options.keys)
24
25
  raise ArgumentError, 'specify Magti.config(options) with :username, :password, :client and :service keys'
25
26
  end
26
27
  options = options.merge(:to => "995#{mobile}", :text => text)
data/lib/magti/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Magti
3
- VERSION = "0.1.0.beta2"
3
+ VERSION = "0.1.0.beta3"
4
4
  end
data/spec/sms_spec.rb ADDED
@@ -0,0 +1,12 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe 'Sending SMS' do
5
+ before(:all) do
6
+ Magti.config({:username => 'dimitri', :password => 'secret', :service => 1, :client => 1})
7
+ @resp = Magti.send_sms '595335514', 'test'
8
+ end
9
+ subject { @resp }
10
+ its(:code) { should == '0000' }
11
+ its(:id) { should > 0 }
12
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magti
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.beta2
4
+ version: 0.1.0.beta3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -80,6 +80,7 @@ files:
80
80
  - magti.gemspec
81
81
  - refs/magti_protocol.pdf
82
82
  - spec/config_spec.rb
83
+ - spec/sms_spec.rb
83
84
  - spec/spec_helper.rb
84
85
  homepage: http://github.com/dimakura/magti
85
86
  licenses: []
@@ -107,5 +108,6 @@ specification_version: 3
107
108
  summary: Gem for sending SMS using MagtiGSM.ge gateway
108
109
  test_files:
109
110
  - spec/config_spec.rb
111
+ - spec/sms_spec.rb
110
112
  - spec/spec_helper.rb
111
113
  has_rdoc: