uni_sender 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
data/lib/uni_sender/version.rb
CHANGED
data/lib/uni_sender.rb
CHANGED
@@ -52,12 +52,12 @@ module UniSender
|
|
52
52
|
params = translate_params(params) if defined?('translate_params')
|
53
53
|
params.merge!({'api_key'=>api_key, 'format'=>'json'})
|
54
54
|
query = make_query(params)
|
55
|
-
url = URI("http://api.unisender.com/#{locale}/api/#{action}
|
56
|
-
JSON.parse(Net::HTTP.
|
55
|
+
url = URI("http://api.unisender.com/#{locale}/api/#{action}")
|
56
|
+
JSON.parse(Net::HTTP.post_form(url, query).body)
|
57
57
|
end
|
58
58
|
|
59
59
|
def make_query(params)
|
60
|
-
params.
|
60
|
+
params.delete_if{|k,v| v.to_s.empty?}
|
61
61
|
end
|
62
62
|
|
63
63
|
end
|
@@ -2,6 +2,12 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe UniSender::Client do
|
4
4
|
|
5
|
-
|
5
|
+
it 'should get invalid key error' do
|
6
|
+
answer = UniSender::Client.new("123abcd123").getLists
|
7
|
+
answer['error'].should_not be_nil
|
8
|
+
answer['code'].should == 'invalid_api_key'
|
9
|
+
end
|
10
|
+
|
11
|
+
specify{ test_client.get_lists.should == test_client.getLists}
|
6
12
|
|
7
13
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
#encoding: utf-8
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe UniSender::Client do
|
@@ -10,6 +11,13 @@ describe UniSender::Client do
|
|
10
11
|
answer['result']['message_id'].should be_an_kind_of(Numeric)
|
11
12
|
end
|
12
13
|
|
14
|
+
it 'should create email template with long body' do
|
15
|
+
answer = test_client.create_email_message(:sender_name=>'Ivan Petrov', :sender_email=>'uni.sender.gem@gmail.com',
|
16
|
+
:subject=>'You need your stuff', :list_id=>available_list_ids.last, :lang=>'en',
|
17
|
+
:body=>"Hi there! Plz send sms with text: #{(0...20000).map{65.+(rand(25)).chr}.join}")
|
18
|
+
answer.should include('result')
|
19
|
+
answer['result']['message_id'].should be_an_kind_of(Numeric)
|
20
|
+
end
|
13
21
|
|
14
22
|
it 'should create sms template by name' do
|
15
23
|
answer = test_client.create_sms_message(:sender=>'Tester',
|
@@ -19,7 +27,7 @@ describe UniSender::Client do
|
|
19
27
|
end
|
20
28
|
|
21
29
|
it 'should create sms template by name' do
|
22
|
-
answer = test_client.create_sms_message(:sender=>'
|
30
|
+
answer = test_client.create_sms_message(:sender=>'12344567890',
|
23
31
|
:list_id=>available_list_ids.last,:body=>"Просто смска with foo message")
|
24
32
|
answer.should include('result')
|
25
33
|
answer['result']['message_id'].should be_an_kind_of(Numeric)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
#encoding: utf-8
|
1
2
|
require "spec_helper"
|
2
3
|
|
3
4
|
describe UniSender::Client do
|
@@ -16,7 +17,7 @@ describe UniSender::Client do
|
|
16
17
|
end
|
17
18
|
|
18
19
|
it 'subscribe person to lists' do
|
19
|
-
answer = test_client.subscribe(:list_ids=>available_list_ids, :fields=>{:email=>'sam@parson.com', :phone=>'
|
20
|
+
answer = test_client.subscribe(:list_ids=>available_list_ids, :fields=>{:email=>'sam@parson.com', :phone=>'+72345678900',
|
20
21
|
:twitter=>'sammy', :name=>'Сеня Парсон'})
|
21
22
|
answer['result']['person_id'].should be_an_kind_of(Numeric)
|
22
23
|
end
|
@@ -28,7 +29,7 @@ describe UniSender::Client do
|
|
28
29
|
end
|
29
30
|
|
30
31
|
it 'should unsubscribe from lists by phone' do
|
31
|
-
answer = test_client.unsubscribe(:contact_type=>'phone', :contact=>'+
|
32
|
+
answer = test_client.unsubscribe(:contact_type=>'phone', :contact=>'+11111111111')
|
32
33
|
answer.should_not include('error')
|
33
34
|
answer.should include('result')
|
34
35
|
end
|
data/spec/spec_helper.rb
CHANGED
data/uni_sender.gemspec
CHANGED
@@ -9,7 +9,6 @@ Gem::Specification.new do |gem|
|
|
9
9
|
gem.homepage = ""
|
10
10
|
|
11
11
|
gem.add_development_dependency 'rspec'
|
12
|
-
gem.add_development_dependency 'ruby-debug'
|
13
12
|
gem.add_development_dependency 'guard-rspec'
|
14
13
|
gem.add_development_dependency 'ruby_gntp'
|
15
14
|
gem.add_dependency 'json'
|
metadata
CHANGED
@@ -1,102 +1,67 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: uni_sender
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 4
|
10
|
-
version: 0.0.4
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Sergey Pchelincev
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-05-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rspec
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70093363337040 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
32
22
|
type: :development
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: ruby-debug
|
36
23
|
prerelease: false
|
37
|
-
|
38
|
-
|
39
|
-
requirements:
|
40
|
-
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
hash: 3
|
43
|
-
segments:
|
44
|
-
- 0
|
45
|
-
version: "0"
|
46
|
-
type: :development
|
47
|
-
version_requirements: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
24
|
+
version_requirements: *70093363337040
|
25
|
+
- !ruby/object:Gem::Dependency
|
49
26
|
name: guard-rspec
|
50
|
-
|
51
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
27
|
+
requirement: &70093363340120 !ruby/object:Gem::Requirement
|
52
28
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
|
57
|
-
segments:
|
58
|
-
- 0
|
59
|
-
version: "0"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
60
33
|
type: :development
|
61
|
-
version_requirements: *id003
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: ruby_gntp
|
64
34
|
prerelease: false
|
65
|
-
|
35
|
+
version_requirements: *70093363340120
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: ruby_gntp
|
38
|
+
requirement: &70093363285100 !ruby/object:Gem::Requirement
|
66
39
|
none: false
|
67
|
-
requirements:
|
68
|
-
- -
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
|
71
|
-
segments:
|
72
|
-
- 0
|
73
|
-
version: "0"
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
74
44
|
type: :development
|
75
|
-
version_requirements: *id004
|
76
|
-
- !ruby/object:Gem::Dependency
|
77
|
-
name: json
|
78
45
|
prerelease: false
|
79
|
-
|
46
|
+
version_requirements: *70093363285100
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: json
|
49
|
+
requirement: &70093363242740 !ruby/object:Gem::Requirement
|
80
50
|
none: false
|
81
|
-
requirements:
|
82
|
-
- -
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
|
85
|
-
segments:
|
86
|
-
- 0
|
87
|
-
version: "0"
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
88
55
|
type: :runtime
|
89
|
-
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70093363242740
|
90
58
|
description: Gem that provide access to unisender.com.ua api
|
91
|
-
email:
|
59
|
+
email:
|
92
60
|
- jalkoby91@gmail.com
|
93
61
|
executables: []
|
94
|
-
|
95
62
|
extensions: []
|
96
|
-
|
97
63
|
extra_rdoc_files: []
|
98
|
-
|
99
|
-
files:
|
64
|
+
files:
|
100
65
|
- .gitignore
|
101
66
|
- Gemfile
|
102
67
|
- Guardfile
|
@@ -112,44 +77,34 @@ files:
|
|
112
77
|
- spec/spec.opt
|
113
78
|
- spec/spec_helper.rb
|
114
79
|
- uni_sender.gemspec
|
115
|
-
homepage:
|
80
|
+
homepage: ''
|
116
81
|
licenses: []
|
117
|
-
|
118
82
|
post_install_message:
|
119
83
|
rdoc_options: []
|
120
|
-
|
121
|
-
require_paths:
|
84
|
+
require_paths:
|
122
85
|
- lib
|
123
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
87
|
none: false
|
125
|
-
requirements:
|
126
|
-
- -
|
127
|
-
- !ruby/object:Gem::Version
|
128
|
-
|
129
|
-
|
130
|
-
- 0
|
131
|
-
version: "0"
|
132
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ! '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
93
|
none: false
|
134
|
-
requirements:
|
135
|
-
- -
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
|
138
|
-
segments:
|
139
|
-
- 0
|
140
|
-
version: "0"
|
94
|
+
requirements:
|
95
|
+
- - ! '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
141
98
|
requirements: []
|
142
|
-
|
143
99
|
rubyforge_project:
|
144
|
-
rubygems_version: 1.8.
|
100
|
+
rubygems_version: 1.8.15
|
145
101
|
signing_key:
|
146
102
|
specification_version: 3
|
147
103
|
summary: See description
|
148
|
-
test_files:
|
104
|
+
test_files:
|
149
105
|
- spec/data_macros.rb
|
150
106
|
- spec/functionality/common_spec.rb
|
151
107
|
- spec/functionality/managing_email_spec.rb
|
152
108
|
- spec/functionality/managing_list_spec.rb
|
153
109
|
- spec/spec.opt
|
154
110
|
- spec/spec_helper.rb
|
155
|
-
has_rdoc:
|