smsway_api 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09176d1235ea2f380396332d79a8df243b8ea598
4
- data.tar.gz: 571f4da870f66092fb25d42f4ef2c05635ebeb5a
3
+ metadata.gz: ffdebeb3d48089f5c04fdd2c6921d42a60096601
4
+ data.tar.gz: 3eab99cc746df54b6ccfa02ce3a671b66a90ed75
5
5
  SHA512:
6
- metadata.gz: 2aa89c3222baaa899d4432c4c120afc63dfba66322f7edd77294278d3cae214f7bb039d7ee63789cdf90264682e1ec54cee426d255f7ce1e49cf1126cb61af88
7
- data.tar.gz: 76ff8095fa0df5eafb4f8db85816b5b1087224d90156176506475a5d9f1b184a6d4942afbb7f30fef683665bf3e4799efc2ba0211aed109f513d7311d226eba0
6
+ metadata.gz: 5ce0a58c24285df5ff1e310b5c75428b153d9333f40d5b567a1eb948413a50a9946d165c132b2bc6d8d32a442c769d1a6ef502c145b520f3128b6db190fc050a
7
+ data.tar.gz: 0b5c328926460cc0b2c8274971f6575bb28764955729f131fba4f1872c0dbc2799f7a2d5df6c276a1c877c8f9da792859fb4f192d88a200896401c1a01be3db4
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.0
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ## smsway_api [![Build Status](https://secure.travis-ci.org/kelion/smsway_api.png)](http://travis-ci.org/kelion/smsway_api) [![Gem Version](https://badge.fury.io/rb/smsway_api.png)](http://badge.fury.io/rb/smswy_api) [![Dependency Status](https://gemnasium.com/kelion/smsway_api.png)](https://gemnasium.com/kelion/smsway_api) [![Code Climate](https://codeclimate.com/github/kelion/smsway_api.png)](https://codeclimate.com/github/kelion/smsway_api)
1
+ ## smsway_api [![Build Status](https://travis-ci.org/KELiON/smsway_api.svg)](http://travis-ci.org/KELiON/smsway_api) [![Gem Version](https://badge.fury.io/rb/smsway_api.png)](http://badge.fury.io/rb/smswy_api) [![Dependency Status](https://gemnasium.com/KELiON/smsway_api.svg)](https://gemnasium.com/KELiON/smsway_api) [![Code Climate](https://codeclimate.com/github/KELiON/smsway_api.png)](https://codeclimate.com/github/KELiON/smsway_api)
2
2
 
3
3
  Ruby wrapper for smsway.ru xml api
4
4
 
@@ -13,4 +13,47 @@ or just
13
13
 
14
14
  ``` sh
15
15
  $ gem install smsway_api
16
- ```
16
+ ```
17
+
18
+ ## Config
19
+
20
+ Parameters for smsway_api should be placed in SmswayApi.configure block. Put smsway_api.rb into `config/initializers` directory of your rails application or just run:
21
+
22
+ rails generate smsway_api:install
23
+
24
+ Example of config file:
25
+
26
+
27
+ SmswayApi.configure do |config|
28
+ config.login = '123'
29
+ config.password = 'AbCdE654'
30
+
31
+
32
+ config.default_sender = 'smsway'
33
+ end
34
+
35
+ ## Usage
36
+
37
+ Now implemented only two methods of smsway api: send message and get balance. You can send sms, flash-sms, wap-push and vcard.
38
+
39
+ Simple sending message: `SmswayApi::API.send_message('test message', phone)`.
40
+ Building and sending VCard:
41
+
42
+ vcard = SmswayApi::Message::Vcard.new({
43
+ name: 'Steave Jobs',
44
+ email: 'jobs@apple.com',
45
+ phone: {
46
+ work: '1-800-275-2273'
47
+ }
48
+ })
49
+ vcard.add_recipient('1-800-694-7466')
50
+ vcard.add_recipient('1-800-800-2775')
51
+ vcard.sender = 'apple'
52
+ SmswayApi::API.send_message(vcard)
53
+
54
+ This example will send vcard to two recipients. Field 'from' will be 'apple'.
55
+
56
+ Get balance:
57
+
58
+ SmswayApi::API.balance
59
+
@@ -0,0 +1,32 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'SmswayApi'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+
19
+
20
+ Bundler::GemHelper.install_tasks
21
+
22
+ require 'rake/testtask'
23
+
24
+ Rake::TestTask.new(:test) do |t|
25
+ t.libs << 'lib'
26
+ t.libs << 'test'
27
+ t.pattern = 'test/**/*_test.rb'
28
+ t.verbose = false
29
+ end
30
+
31
+
32
+ task default: :test
@@ -17,7 +17,14 @@ module SmswayApi
17
17
 
18
18
  req = Net::HTTP::Post.new(uri.path, DEFAULT_HEADERS.merge(headers))
19
19
  req.body = options.delete(:request)
20
- http.request(req).body
20
+ response = http.request(req).body
21
+ if SmswayApi.log_requests
22
+ SmswayApi.logger.debug("[smswayapi] request \n #{req.body}")
23
+ end
24
+ if SmswayApi.log_responses
25
+ SmswayApi.logger.debug("[smswayapi] response \n #{response}")
26
+ end
27
+ response
21
28
  end
22
29
 
23
30
  def method_missing name, *args
@@ -1,3 +1,3 @@
1
1
  module SmswayApi
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -20,6 +20,8 @@ Gem::Specification.new do |s|
20
20
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
21
21
  s.require_paths = ['lib']
22
22
 
23
+ s.required_ruby_version = '>= 1.9.2'
24
+
23
25
  s.add_runtime_dependency 'builder', '~> 3.2'
24
26
 
25
27
  s.add_development_dependency 'rake'
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smsway_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandr Subbotin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-13 00:00:00.000000000 Z
11
+ date: 2014-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '2.14'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.14'
55
55
  description: Simple ruby wrapper for smsway.ru XML API. Provides simples methods for
@@ -60,10 +60,12 @@ executables: []
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
+ - ".travis.yml"
63
64
  - Gemfile
64
65
  - Gemfile.lock
65
66
  - MIT-LICENSE
66
67
  - README.md
68
+ - Rakefile
67
69
  - lib/generators/smsway_api/install/USAGE
68
70
  - lib/generators/smsway_api/install/install_generator.rb
69
71
  - lib/generators/smsway_api/install/templates/initializer.rb
@@ -93,17 +95,17 @@ require_paths:
93
95
  - lib
94
96
  required_ruby_version: !ruby/object:Gem::Requirement
95
97
  requirements:
96
- - - '>='
98
+ - - ">="
97
99
  - !ruby/object:Gem::Version
98
- version: '0'
100
+ version: 1.9.2
99
101
  required_rubygems_version: !ruby/object:Gem::Requirement
100
102
  requirements:
101
- - - '>='
103
+ - - ">="
102
104
  - !ruby/object:Gem::Version
103
105
  version: '0'
104
106
  requirements: []
105
107
  rubyforge_project:
106
- rubygems_version: 2.2.1
108
+ rubygems_version: 2.2.2
107
109
  signing_key:
108
110
  specification_version: 4
109
111
  summary: Ruby wrapper for smsway.ru xml API
@@ -111,4 +113,3 @@ test_files:
111
113
  - spec/smsway_api/configuration_spec.rb
112
114
  - spec/smsway_api/message/sms_spec.rb
113
115
  - spec/spec_helper.rb
114
- has_rdoc: