smsaero 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +4 -0
  3. data/lib/smsaero.rb +24 -0
  4. metadata +45 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5a55d0847622c0b6b465d510115e47d3397b9fb4
4
+ data.tar.gz: 01dfb775ac01f773a72819f0a651d0760ff36d83
5
+ SHA512:
6
+ metadata.gz: d39c4fc9f1f977405ac597e8f0f86c79ae4439446c7ebb02d1a5ac38a88e839704c414392de420e6dd916e32c44b680b259da365a786fea435f95b3d31e72b3b
7
+ data.tar.gz: 0cf866b98302a05aee5f83294b3a4952509cfe44c0f42ad7660ccea5eb5f045bb942757b8ee8d3393b28f456f793409605685c019a44b7e5d9ab08cac6c563a4
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ smsaero
2
+ =======
3
+
4
+ API for smsaero integration.
data/lib/smsaero.rb ADDED
@@ -0,0 +1,24 @@
1
+ require 'net/http'
2
+
3
+ class SMSAero
4
+ URL = 'http://gate.smsaero.ru/%{action}'
5
+
6
+ def initialize(*args)
7
+ options = args.extract_options!
8
+
9
+ raise 'User and password should be provided!' unless options[:user] && options[:password]
10
+
11
+ @user = options[:user]
12
+ @password_hash = Digest::MD5.digest options[:password]
13
+ end
14
+
15
+ def method_missing(action, *args, &block)
16
+ options = args.extract_options!
17
+ options.reverse_merge! answer: :json
18
+
19
+ uri = URI(URL % { action: action })
20
+ uri.query = URI.encode_www_form options
21
+
22
+ Net::HTTP.post_form uri, user: @user, password: @password_hash
23
+ end
24
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: smsaero
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Yury Kaliada
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-13 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: API for smsaero integration.
14
+ email: fut.wrk@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - README.md
20
+ - lib/smsaero.rb
21
+ homepage: http://rubygems.org/gems/smsaero
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.0.6
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: API for smsaero integration.
45
+ test_files: []