smscru 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d9f784e611fed9289ba0f244ebb83b4d595f490
4
- data.tar.gz: a3b700d4868493e5a70d2b75a91ac856b6080824
3
+ metadata.gz: f87c0f9add477537a8db1112af0d0c19f65954d4
4
+ data.tar.gz: 217854a5c9d3f71097a5c338b79dd5d2d59f60ac
5
5
  SHA512:
6
- metadata.gz: 5a8975cb7a6c4154fd6207b727fcfd0b8941279eac1afe1695cd11d105f0d1843c4a92cc44a78e3aa2b585576bd8ba51ff7a769ec1844c2340d73a0be82f8ccb
7
- data.tar.gz: 9852f112ee172aed2c6a6eee5212c3fba98ff5109b78e57c8f2dafbdba0da680510c6c35e9fc9d154cadc7bff837d5e40377edfc8bc0030034a888087d1ff835
6
+ metadata.gz: a15830f6b50c1379e5b9c04652abdce262ff902aeb6ee38f40ea0f7caf25aeaaa86d3caf2a77b6c79e13d692dcc3eefc1c847a1a6e16280a6f635163ef925f21
7
+ data.tar.gz: 022a2ba1797dc292bbd5cade3785527b42da6db23270bec721333b9472d03a1228e19cb19191bf3d6fb700b4013ec3dd9ae9f90db917b09fc88a3acaf9accc74
@@ -1,8 +1,9 @@
1
1
  require 'json'
2
- require 'net/http'
2
+ require 'faraday'
3
3
 
4
4
  module Smscru
5
5
  class Client
6
+ SEND_URL = 'http://smsc.ru/sys/send.php'
6
7
  attr_reader :config
7
8
 
8
9
  def initialize(options={})
@@ -13,15 +14,19 @@ module Smscru
13
14
  def send_message(text, phones, options={})
14
15
  params = {
15
16
  mes: text,
16
- phones: Array(phones),
17
+ phones: Array(phones).join(','),
17
18
  login: config.login,
18
19
  psw: config.password,
19
20
  charset: 'utf-8',
20
21
  fmt: 3
21
22
  }
22
23
 
23
- uri = URI.parse('http://smsc.ru/sys/send.php')
24
- response = Net::HTTP.post_form(uri, params.merge(options))
24
+ connection = Faraday.new do |i|
25
+ i.request :url_encoded
26
+ i.response :logger
27
+ i.adapter Faraday.default_adapter
28
+ end
29
+ response = connection.post SEND_URL, params
25
30
 
26
31
  JSON.parse(response.body)
27
32
  end
@@ -1,3 +1,3 @@
1
1
  module Smscru
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
@@ -21,4 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency 'bundler', '~> 1.3'
22
22
  spec.add_development_dependency 'rake'
23
23
  spec.add_development_dependency 'minitest', '~> 5.0.8'
24
+ spec.add_runtime_dependency 'faraday'
24
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smscru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Nartimov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-09 00:00:00.000000000 Z
11
+ date: 2014-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 5.0.8
55
+ - !ruby/object:Gem::Dependency
56
+ name: faraday
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  description: Ruby interface to the smsc.ru SMS gateway service.
56
70
  email:
57
71
  - just.lest@gmail.com