mobile_pronto 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ require "httparty"
2
+
3
+ Dir[File.dirname(__FILE__) + '/mobile_pronto/*.rb'].each do |file|
4
+ require file
5
+ end
@@ -0,0 +1,22 @@
1
+ module MobilePronto
2
+ class Parameters
3
+
4
+ attr_reader :value
5
+
6
+ def initialize(credencial)
7
+ @value = {"CREDENCIAL" => credencial}
8
+ end
9
+
10
+ def method_missing(name, *args)
11
+ obj = self.dup
12
+
13
+ obj[name.to_s.gsub!("with_", "").upcase] = args.first
14
+
15
+ obj
16
+ end
17
+
18
+ def []=(key, value)
19
+ self.value[key] = value
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,54 @@
1
+ module MobilePronto
2
+
3
+ class SMS
4
+
5
+ include HTTParty
6
+
7
+ attr_accessor :credential, :username, :parameters
8
+
9
+ base_uri "http://www.mpgateway.com/v_2_00"
10
+
11
+ def initialize(credential, username)
12
+ self.credential = credential
13
+ self.username = username
14
+ self.parameters = Parameters.new(self.credential)
15
+ end
16
+
17
+ def credits
18
+ response = self.class.get "/smscredits/credits.aspx", query: parameters.value
19
+ response.parsed_response
20
+ end
21
+
22
+ def send(mobile, aux_user, message)
23
+ response = self.class.get "/smspush/enviasms.aspx",
24
+ query: parameters.with_principal_user(username).
25
+ with_aux_user(aux_user).with_mobile(mobile).
26
+ with_message(message).with_send_project('N').value
27
+ response.parsed_response
28
+ end
29
+
30
+ def follow(mobile, aux_user, message)
31
+ response = self.class.get "/smsfollow/smsfollow.aspx",
32
+ query: parameters.with_principal_user(username).
33
+ with_aux_user(aux_user).with_mobile(mobile).
34
+ with_message(message).with_send_project('N').value
35
+ response.parsed_response
36
+ end
37
+
38
+ def status(message_id)
39
+ response = self.class.get "/smsstatus/status.aspx",
40
+ query: parameters.with_id(message_id).value
41
+ response.parsed_response
42
+ end
43
+
44
+ def query01(start_date, end_date, aux_user, mobile, status_code)
45
+ response = self.class.get "/query01/query01.aspx",
46
+ query: parameters.with_principal_user(username).
47
+ with_aux_user(aux_user).with_mobile(mobile).
48
+ with_status_code(status_code).with_start_date(start_date).
49
+ with_end_date(end_date).value
50
+
51
+ response.parsed_response
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,3 @@
1
+ module MobilePronto
2
+ VERSION = "0.2.1"
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mobile_pronto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-07 00:00:00.000000000 Z
13
+ date: 2012-12-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: webmock
@@ -115,7 +115,11 @@ email:
115
115
  executables: []
116
116
  extensions: []
117
117
  extra_rdoc_files: []
118
- files: []
118
+ files:
119
+ - lib/mobile_pronto/parameters.rb
120
+ - lib/mobile_pronto/sms.rb
121
+ - lib/mobile_pronto/version.rb
122
+ - lib/mobile_pronto.rb
119
123
  homepage: http://github.com/brunnogomes/mobile-pronto
120
124
  licenses: []
121
125
  post_install_message:
@@ -136,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
140
  version: '0'
137
141
  requirements: []
138
142
  rubyforge_project:
139
- rubygems_version: 1.8.24
143
+ rubygems_version: 1.8.23
140
144
  signing_key:
141
145
  specification_version: 3
142
146
  summary: MobilePronto API Wrapper