e_pochta 0.2.1 → 0.3.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 +8 -8
- data/lib/e_pochta.rb +55 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTFkOGU0ODVlZTk5MmU4NGU3ZjkzOTViZmE5M2NiZDUyZDFkMjc5Zg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGQwMGVhYzUxYjFkZjg1ZTIzMDY3OWY5NmZkNGQ0OGQ1NmFmYjkzOA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzFhZTM1ZTRjN2EzN2QzMzM5MzhmMjNjYThkNzliMzcxOWY2YjljODc2Njlm
|
10
|
+
ZDNmMDBkNDcxYzJlODIwNjk5ZjcxOTRhODE2OTFkMDEyYzg1ODlhZGJkNjdk
|
11
|
+
Yzc0NmViY2I3NWI1MzljZGZkMzZjZWY4MTZlMjhmMmMxOWJmNDM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGRmMDQ1YjEwMjM4NmI5MDNjOGIzMDY0ZmU0YWRkN2E4ODY4MGJkYjVmNmFj
|
14
|
+
ZmQ5ZDcwYmIyMTRmMDU0MzUxNTliNjgyZDc2YTY5YWQzNjM0ODAwYzZlNjZk
|
15
|
+
YjczYTg3ZjY2NWJjOTk0YzU3ODYzNjk1NDVkNjk0ZTBhNDVkMmY=
|
data/lib/e_pochta.rb
CHANGED
@@ -119,4 +119,59 @@ class EPochta
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
+
def get_campaign_status(params)
|
123
|
+
params['action'] = 'getCampaignInfo'
|
124
|
+
params['version'] = '3.0'
|
125
|
+
result = exec_command(params, 'getCampaignInfo')
|
126
|
+
result = JSON.parse(result.body)
|
127
|
+
|
128
|
+
if result.has_key? 'error'
|
129
|
+
false
|
130
|
+
else
|
131
|
+
result['result']['status_text'] = get_status_text(result['result']['status'].to_i)
|
132
|
+
result['result']
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def campaign_delivery_statuses(params)
|
137
|
+
params['action'] = 'getCampaignDeliveryStats'
|
138
|
+
params['version'] = '3.0'
|
139
|
+
response = exec_command(params, 'getCampaignDeliveryStats')
|
140
|
+
response = JSON.parse(response.body)
|
141
|
+
|
142
|
+
if response.has_key? 'error'
|
143
|
+
false
|
144
|
+
else
|
145
|
+
# makes "phone->status" structure from returned response
|
146
|
+
format_delivery_status_hash(response['result'])
|
147
|
+
end
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
private
|
152
|
+
# helpers
|
153
|
+
def get_status_text(code)
|
154
|
+
status_text = case code
|
155
|
+
when 0 then 'pending'
|
156
|
+
when 1 then 'not_enought_money'
|
157
|
+
when 2 then 'in_process'
|
158
|
+
when 3 then 'done'
|
159
|
+
when 4 then 'wrong_numbers'
|
160
|
+
when 5 then 'partialy_done'
|
161
|
+
when 6 then 'spam'
|
162
|
+
when 7 then 'wrong_sender_name'
|
163
|
+
when 8 then 'paused'
|
164
|
+
when 9 then 'planned'
|
165
|
+
when 10 then 'on_moderation'
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def format_delivery_status_hash(response)
|
170
|
+
result = {}
|
171
|
+
response['phone'].each_with_index do |client, index|
|
172
|
+
result[client] = response['status'][index]
|
173
|
+
end
|
174
|
+
result
|
175
|
+
end
|
176
|
+
|
122
177
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: e_pochta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Tikijian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Class for interaction with E-Pochta API v.3.0 - an online sms-service
|
14
14
|
http://www.epochta.ru/
|