Class: MessageService
Overview
팝빌 문자 API Service Implementation
Constant Summary
Constants inherited
from BaseService
BaseService::BOUNDARY, BaseService::POPBILL_APIVersion, BaseService::ServiceID_REAL, BaseService::ServiceID_TEST, BaseService::ServiceURL_REAL, BaseService::ServiceURL_TEST
Instance Attribute Summary
Attributes inherited from BaseService
#isTest, #linkhub, #scopes, #token_table
Class Method Summary
collapse
Instance Method Summary
collapse
-
#cancelReserve(corpNum, receiptNum, userID = '') ⇒ Object
-
#getAutoDenyList(corpNum, userID = '') ⇒ Object
-
#getChargeInfo(corpNum, msgType, userID = '') ⇒ Object
-
#getMessages(corpNum, receiptNum, userID = '') ⇒ Object
-
#getUnitCost(corpNum, msgType, userID = '') ⇒ Object
-
#getURL(corpNum, togo, userID = '') ⇒ Object
-
#search(corpNum, sDate, eDate, state, item, reserveYN, senderYN, page, perPage, order, userID = '') ⇒ Object
-
#sendLMS(corpNum, sender, senderName, receiver, receiverName, subject, contents, reserveDT = '', adsYN = false, userID = '') ⇒ Object
-
#sendLMS_multi(corpNum, sender, senderName, subject, contents, messages, reserveDT = '', adsYN = false, userID = '') ⇒ Object
-
#sendMessage(msgType, corpNum, sender, senderName, subject, contents, messages, reserveDT, adsYN = false, userID = '') ⇒ Object
-
#sendMMS(corpNum, sender, senderName, receiver, receiverName, subject, contents, filePath, reserveDT = '', adsYN = false, userID = '') ⇒ Object
-
#sendMMS_multi(corpNum, sender, senderName, subject, contents, messages, filePath, reserveDT = '', adsYN = false, userID = '') ⇒ Object
-
#sendSMS(corpNum, sender, senderName, receiver, receiverName, contents, reserveDT = '', adsYN = false, userID = '') ⇒ Object
-
#sendSMS_multi(corpNum, sender, senderName, contents, messages, reserveDT = '', adsYN = false, userID = '') ⇒ Object
-
#sendXMS(corpNum, sender, senderName, receiver, receiverName, subject, contents, reserveDT = '', adsYN = false, userID = '') ⇒ Object
-
#sendXMS_multi(corpNum, sender, senderName, subject, contents, messages, reserveDT = '', adsYN = false, userID = '') ⇒ Object
Methods inherited from BaseService
#addScope, #checkID, #checkIsMember, #getBalance, #getCorpInfo, #getPartnerBalance, #getPopbillURL, #getServiceID, #getServiceURL, #getSession_Token, #gzip_parse, #httpget, #httppost, #httppostfile, #httppostfiles, #joinMember, #listContact, #registContact, #setIsTest, #updateContact, #updateCorpInfo
Class Method Details
.instance(linkID, secretKey) ⇒ Object
7
8
9
10
11
12
13
14
|
# File 'lib/popbill/message.rb', line 7
def instance(linkID, secretKey)
super(linkID, secretKey)
@instance ||= new
@instance.addScope("150")
@instance.addScope("151")
@instance.addScope("152")
return @instance
end
|
Instance Method Details
#cancelReserve(corpNum, receiptNum, userID = '') ⇒ Object
222
223
224
225
226
227
228
229
230
231
|
# File 'lib/popbill/message.rb', line 222
def cancelReserve(corpNum, receiptNum, userID = '')
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
if receiptNum.to_s == ''
raise PopbillException.new(-99999999, "접수번호(receiptNum)가 입력되지 않았습니다.")
end
httpget("/Message/#{receiptNum}/Cancel", corpNum, userID)
end
|
#getAutoDenyList(corpNum, userID = '') ⇒ Object
25
26
27
28
29
30
|
# File 'lib/popbill/message.rb', line 25
def getAutoDenyList(corpNum, userID = '')
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
httpget("/Message/Denied", corpNum, userID)
end
|
#getChargeInfo(corpNum, msgType, userID = '') ⇒ Object
18
19
20
21
22
23
|
# File 'lib/popbill/message.rb', line 18
def getChargeInfo(corpNum, msgType, userID = '')
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
httpget("/Message/ChargeInfo?Type=#{msgType}", corpNum, userID)
end
|
#getMessages(corpNum, receiptNum, userID = '') ⇒ Object
211
212
213
214
215
216
217
218
219
220
|
# File 'lib/popbill/message.rb', line 211
def getMessages(corpNum, receiptNum, userID = '')
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
if receiptNum.to_s == ''
raise PopbillException.new(-99999999, "접수번호(receiptNum)가 입력되지 않았습니다.")
end
httpget("/Message/#{receiptNum}", corpNum, userID)
end
|
#getUnitCost(corpNum, msgType, userID = '') ⇒ Object
32
33
34
35
36
37
|
# File 'lib/popbill/message.rb', line 32
def getUnitCost(corpNum, msgType, userID = '')
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
httpget("/Message/UnitCost?Type=#{msgType}", corpNum, userID)['unitCost']
end
|
#getURL(corpNum, togo, userID = '') ⇒ Object
233
234
235
236
237
238
239
|
# File 'lib/popbill/message.rb', line 233
def getURL(corpNum, togo, userID = '')
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
httpget("/Message/?TG=#{togo}", corpNum, userID)['url']
end
|
#search(corpNum, sDate, eDate, state, item, reserveYN, senderYN, page, perPage, order, userID = '') ⇒ Object
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
|
# File 'lib/popbill/message.rb', line 241
def search(corpNum, sDate, eDate, state, item, reserveYN, senderYN, page, perPage,
order, userID = '')
if corpNum.length != 10
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
end
if sDate.to_s == ''
raise PopbillException.new('-99999999', '시작일자가 입력되지 않았습니다.')
end
if eDate.to_s == ''
raise PopbillException.new('-99999999', '종료일자가 입력되지 않았습니다.')
end
uri = "/Message/Search?SDate=#{sDate}&EDate=#{eDate}"
uri += "&State=" + state.join(',')
uri += "&Item=" + item.join(',')
uri += "&ReserveYN=" + reserveYN
uri += "&SenderYN=" + senderYN
uri += "&Page=" + page.to_s
uri += "&PerPage=" + perPage.to_s
uri += "&Order=" + order
httpget(URI.escape(uri), corpNum, userID)
end
|
#sendLMS(corpNum, sender, senderName, receiver, receiverName, subject, contents, reserveDT = '', adsYN = false, userID = '') ⇒ Object
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# File 'lib/popbill/message.rb', line 103
def sendLMS(corpNum, sender, senderName, receiver, receiverName, subject, contents,
reserveDT = '', adsYN = false, userID = '')
messages = [
{
"snd" => sender,
"sndName" => senderName,
"rcv" => receiver,
"rcvnm" => receiverName,
"msg" => contents,
"sjt" => subject,
}
]
sendMessage("LMS", corpNum, '', '', '', '', messages, reserveDT,
adsYN, userID
)
end
|
#sendLMS_multi(corpNum, sender, senderName, subject, contents, messages, reserveDT = '', adsYN = false, userID = '') ⇒ Object
149
150
151
152
153
154
155
|
# File 'lib/popbill/message.rb', line 149
def sendLMS_multi(corpNum, sender, senderName, subject, contents, messages,
reserveDT = '', adsYN = false, userID = '')
sendMessage("LMS", corpNum, sender, senderName, subject, contents, messages,
reserveDT, adsYN, userID
)
end
|
#sendMessage(msgType, corpNum, sender, senderName, subject, contents, messages, reserveDT, adsYN = false, userID = '') ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/popbill/message.rb', line 40
def sendMessage(msgType, corpNum, sender, senderName, subject, contents,
messages, reserveDT, adsYN = false, userID = '')
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
req = {}
if sender.to_s != ''
req["snd"] = sender
end
if senderName.to_s != ''
req["sndnm"] = senderName
end
if subject.to_s != ''
req["subject"] = subject
end
if contents.to_s != ''
req["content"] = contents
end
if reserveDT.to_s != ''
req["sndDT"] = reserveDT
end
if messages.to_s != ''
req["msgs"] = messages
end
if adsYN
req["adsYN"] = true
end
postData = req.to_json
httppost("/#{msgType}", corpNum, postData, "", userID)['receiptNum']
end
|
#sendMMS(corpNum, sender, senderName, receiver, receiverName, subject, contents, filePath, reserveDT = '', adsYN = false, userID = '') ⇒ Object
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
# File 'lib/popbill/message.rb', line 158
def sendMMS(corpNum, sender, senderName, receiver, receiverName, subject, contents,
filePath, reserveDT = '', adsYN = false, userID = '')
messages = [
{
"snd" => sender,
"sndnm" => senderName,
"rcv" => receiver,
"rcvnm" => receiverName,
"msg" => contents,
"sjt" => subject,
}
]
sendMMS_multi(corpNum, sender, senderName, subject, contents, messages, filePath,
reserveDT, adsYN, userID
)
end
|
#sendMMS_multi(corpNum, sender, senderName, subject, contents, messages, filePath, reserveDT = '', adsYN = false, userID = '') ⇒ Object
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
# File 'lib/popbill/message.rb', line 177
def sendMMS_multi(corpNum, sender, senderName, subject, contents, messages, filePath,
reserveDT = '', adsYN = false, userID = '')
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
req = {}
if sender.to_s != ''
req["snd"] = sender
end
if senderName.to_s != ''
req["sndnm"] = senderName
end
if subject.to_s != ''
req["subject"] = subject
end
if contents.to_s != ''
req["content"] = contents
end
if reserveDT.to_s != ''
req["sndDT"] = reserveDT
end
if messages.to_s != ''
req["msgs"] = messages
end
if adsYN
req["adsYN"] = true
end
httppostfile("/MMS", corpNum, req, [filePath], userID)['receiptNum']
end
|
#sendSMS(corpNum, sender, senderName, receiver, receiverName, contents, reserveDT = '', adsYN = false, userID = '') ⇒ Object
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# File 'lib/popbill/message.rb', line 77
def sendSMS(corpNum, sender, senderName, receiver, receiverName, contents,
reserveDT = '', adsYN = false, userID = '')
messages = [
{
"snd" => sender,
"sndName" => senderName,
"rcv" => receiver,
"rcvnm" => receiverName,
"msg" => contents,
}
]
sendMessage("SMS", corpNum, '', '', '', '', messages, reserveDT,
adsYN, userID
)
end
|
#sendSMS_multi(corpNum, sender, senderName, contents, messages, reserveDT = '', adsYN = false, userID = '') ⇒ Object
94
95
96
97
98
99
100
|
# File 'lib/popbill/message.rb', line 94
def sendSMS_multi(corpNum, sender, senderName, contents, messages, reserveDT = '',
adsYN = false, userID = '')
sendMessage("SMS", corpNum, sender, senderName, '', contents, messages, reserveDT,
adsYN, userID
)
end
|
#sendXMS(corpNum, sender, senderName, receiver, receiverName, subject, contents, reserveDT = '', adsYN = false, userID = '') ⇒ Object
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
# File 'lib/popbill/message.rb', line 130
def sendXMS(corpNum, sender, senderName, receiver, receiverName, subject, contents,
reserveDT = '', adsYN = false, userID = '')
messages = [
{
"snd" => sender,
"sndName" => senderName,
"rcv" => receiver,
"rcvnm" => receiverName,
"msg" => contents,
"sjt" => subject,
}
]
sendMessage("XMS", corpNum, '', '', '', '', messages, reserveDT,
adsYN, userID
)
end
|
#sendXMS_multi(corpNum, sender, senderName, subject, contents, messages, reserveDT = '', adsYN = false, userID = '') ⇒ Object
122
123
124
125
126
127
128
|
# File 'lib/popbill/message.rb', line 122
def sendXMS_multi(corpNum, sender, senderName, subject, contents, messages,
reserveDT = '', adsYN = false, userID = '')
sendMessage("XMS", corpNum, sender, senderName, subject, contents, messages,
reserveDT, adsYN, userID
)
end
|