Class: KakaoService
Overview
팝빌 카카오톡 API Service Implementation
Constant Summary
Constants inherited
from BaseService
BaseService::BOUNDARY, BaseService::POPBILL_APIVersion, BaseService::ServiceID_REAL, BaseService::ServiceID_TEST, BaseService::ServiceURL_GA_REAL, BaseService::ServiceURL_GA_TEST, BaseService::ServiceURL_REAL, BaseService::ServiceURL_Static_REAL, BaseService::ServiceURL_Static_TEST, BaseService::ServiceURL_TEST
Instance Attribute Summary
Attributes inherited from BaseService
#ipRestrictOnOff, #isTest, #linkhub, #scopes, #token_table, #useGAIP, #useLocalTimeYN, #useStaticIP
Class Method Summary
collapse
Instance Method Summary
collapse
-
#cancelReserve(corpNum, receiptNum, userID = '') ⇒ Object
-
#cancelReserveRN(corpNum, requestNum, userID = '') ⇒ Object
-
#getATSTemplate(corpNum, templateCode, userID = '') ⇒ Object
-
#getATSTemplateMgtURL(corpNum, userID) ⇒ Object
-
#getChargeInfo(corpNum, msgType, userID = '') ⇒ Object
-
#getMessages(corpNum, receiptNum, userID = '') ⇒ Object
-
#getMessagesRN(corpNum, requestNum, userID = '') ⇒ Object
-
#getPlusFriendMgtURL(corpNum, userID) ⇒ Object
-
#getSenderNumberList(corpNum, userID = '') ⇒ Object
-
#getSenderNumberMgtURL(corpNum, userID) ⇒ Object
-
#getSentListURL(corpNum, userID) ⇒ Object
-
#getUnitCost(corpNum, msgType, userID = '') ⇒ Object
-
#getURL(corpNum, togo, userID = '') ⇒ Object
-
#listATSTemplate(corpNum, userID = '') ⇒ Object
-
#listPlusFriendID(corpNum, userID = '') ⇒ Object
-
#search(corpNum, sDate, eDate, state, item, reserveYN, senderYN, page, perPage, order, userID = '', queryString = '') ⇒ Object
-
#sendATS_multi(corpNum, templateCode, snd, altSendType, sndDT, msgs, requestNum = '', userID = '', btns = '') ⇒ Object
-
#sendATS_one(corpNum, templateCode, snd, content, altContent, altSendType, sndDT, receiver, receiverName, requestNum = '', userID = '', btns = '') ⇒ Object
-
#sendATS_same(corpNum, templateCode, snd, content, altContent, altSendType, sndDT, msgs, requestNum = '', userID = '', btns = '') ⇒ Object
-
#sendFMS_multi(corpNum, plusFriendID, snd, altSendType, sndDT, filePath, imageURL, msgs, btns, adsYN = false, requestNum = '', userID = '') ⇒ Object
-
#sendFMS_one(corpNum, plusFriendID, snd, content, altContent, altSendType, sndDT, filePath, imageURL, receiver, receiverName, btns, adsYN = false, requestNum = '', userID = '') ⇒ Object
-
#sendFMS_same(corpNum, plusFriendID, snd, content, altContent, altSendType, sndDT, filePath, imageURL, msgs, btns, adsYN = false, requestNum = '', userID = '') ⇒ Object
-
#sendFTS_multi(corpNum, plusFriendID, snd, altSendType, sndDT, msgs, btns, adsYN = false, requestNum = '', userID = '') ⇒ Object
-
#sendFTS_one(corpNum, plusFriendID, snd, content, altContent, altSendType, sndDT, receiver, receiverName, btns, adsYN = false, requestNum = '', userID = '') ⇒ Object
-
#sendFTS_same(corpNum, plusFriendID, snd, content, altContent, altSendType, sndDT, msgs, btns, adsYN = false, requestNum = '', userID = '') ⇒ Object
Methods inherited from BaseService
#addScope, #checkID, #checkIsMember, #getAccessURL, #getBalance, #getChargeURL, #getContactInfo, #getCorpInfo, #getPartnerBalance, #getPartnerURL, #getPaymentURL, #getPopbillURL, #getServiceID, #getServiceURL, #getSession_Token, #getUseHistoryURL, #gzip_parse, #httpget, #httppost, #httppostbulk, #httppostfile, #httppostfiles, #joinMember, #listContact, #registContact, #setIpRestrictOnOff, #setIsTest, #setUseGAIP, #setUseLocalTimeYN, #setUseStaticIP, #updateContact, #updateCorpInfo
Class Method Details
.instance(linkID, secretKey) ⇒ Object
7
8
9
10
11
12
13
14
|
# File 'lib/popbill/kakaotalk.rb', line 7
def instance(linkID, secretKey)
super(linkID, secretKey)
@instance ||= new
@instance.addScope("153")
@instance.addScope("154")
@instance.addScope("155")
return @instance
end
|
Instance Method Details
#cancelReserve(corpNum, receiptNum, userID = '') ⇒ Object
202
203
204
205
206
207
|
# File 'lib/popbill/kakaotalk.rb', line 202
def cancelReserve(corpNum, receiptNum, userID = '')
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
raise PopbillException.new(-99999999, "접수번호(receiptNum)가 입력되지 않았습니다.") if receiptNum.to_s == ''
httpget("/KakaoTalk/#{receiptNum}/Cancel", corpNum, userID)
end
|
#cancelReserveRN(corpNum, requestNum, userID = '') ⇒ Object
209
210
211
212
213
214
|
# File 'lib/popbill/kakaotalk.rb', line 209
def cancelReserveRN(corpNum, requestNum, userID = '')
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
raise PopbillException.new(-99999999, "요청번호(requestNum)가 입력되지 않았습니다.") if requestNum.to_s == ''
httpget("/KakaoTalk/Cancel/#{requestNum}", corpNum, userID)
end
|
#getATSTemplate(corpNum, templateCode, userID = '') ⇒ Object
79
80
81
82
83
84
|
# File 'lib/popbill/kakaotalk.rb', line 79
def getATSTemplate(corpNum, templateCode, userID = '')
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
raise PopbillException.new(-99999999, "템플릿 코드가 입력되지 않았습니다.")if templateCode.to_s == ''
httpget("/KakaoTalk/GetATSTemplate/#{templateCode}", corpNum, userID)
end
|
#getATSTemplateMgtURL(corpNum, userID) ⇒ Object
48
49
50
51
52
53
54
55
|
# File 'lib/popbill/kakaotalk.rb', line 48
def getATSTemplateMgtURL(corpNum, userID)
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
response = httpget("/KakaoTalk/?TG=TEMPLATE", corpNum, userID)
response['url']
end
|
#getChargeInfo(corpNum, msgType, userID = '') ⇒ Object
259
260
261
262
263
|
# File 'lib/popbill/kakaotalk.rb', line 259
def getChargeInfo(corpNum, msgType, userID = '')
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
httpget("/KakaoTalk/ChargeInfo?Type=#{msgType}", corpNum, userID)
end
|
#getMessages(corpNum, receiptNum, userID = '') ⇒ Object
217
218
219
220
221
222
|
# File 'lib/popbill/kakaotalk.rb', line 217
def getMessages(corpNum, receiptNum, userID = '')
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
raise PopbillException.new(-99999999, "접수번호(receiptNum)가 입력되지 않았습니다.") if receiptNum.to_s == ''
httpget("/KakaoTalk/#{receiptNum}", corpNum, userID)
end
|
#getMessagesRN(corpNum, requestNum, userID = '') ⇒ Object
224
225
226
227
228
229
|
# File 'lib/popbill/kakaotalk.rb', line 224
def getMessagesRN(corpNum, requestNum, userID = '')
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
raise PopbillException.new(-99999999, "요청번호(requestNum)가 입력되지 않았습니다.") if requestNum.to_s == ''
httpget("/KakaoTalk/Get/#{requestNum}", corpNum, userID)
end
|
#getPlusFriendMgtURL(corpNum, userID) ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'lib/popbill/kakaotalk.rb', line 28
def getPlusFriendMgtURL(corpNum, userID)
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
response = httpget("/KakaoTalk/?TG=PLUSFRIEND", corpNum, userID)
response['url']
end
|
#getSenderNumberList(corpNum, userID = '') ⇒ Object
73
74
75
76
77
|
# File 'lib/popbill/kakaotalk.rb', line 73
def getSenderNumberList(corpNum, userID = '')
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
httpget("/Message/SenderNumber", corpNum, userID)
end
|
#getSenderNumberMgtURL(corpNum, userID) ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'lib/popbill/kakaotalk.rb', line 38
def getSenderNumberMgtURL(corpNum, userID)
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
response = httpget("/Message/?TG=SENDER", corpNum, userID)
response['url']
end
|
#getSentListURL(corpNum, userID) ⇒ Object
58
59
60
61
62
63
64
65
|
# File 'lib/popbill/kakaotalk.rb', line 58
def getSentListURL(corpNum, userID)
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
response = httpget("/KakaoTalk/?TG=BOX", corpNum, userID)
response['url']
end
|
#getUnitCost(corpNum, msgType, userID = '') ⇒ Object
253
254
255
256
257
|
# File 'lib/popbill/kakaotalk.rb', line 253
def getUnitCost(corpNum, msgType, userID = '')
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
httpget("/KakaoTalk/UnitCost?Type=#{msgType}", corpNum, userID)
end
|
#getURL(corpNum, togo, userID = '') ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/popbill/kakaotalk.rb', line 19
def getURL(corpNum, togo, userID = '')
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
(togo == "SENDER") ?
httpget("/Message/?TG=#{togo}", corpNum, userID)['url'] :
httpget("/KakaoTalk/?TG=#{togo}", corpNum, userID)['url']
end
|
#listATSTemplate(corpNum, userID = '') ⇒ Object
86
87
88
89
90
|
# File 'lib/popbill/kakaotalk.rb', line 86
def listATSTemplate(corpNum, userID = '')
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
httpget("/KakaoTalk/ListATSTemplate", corpNum, userID)
end
|
#listPlusFriendID(corpNum, userID = '') ⇒ Object
67
68
69
70
71
|
# File 'lib/popbill/kakaotalk.rb', line 67
def listPlusFriendID(corpNum, userID = '')
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
httpget("/KakaoTalk/ListPlusFriendID", corpNum, userID)
end
|
#search(corpNum, sDate, eDate, state, item, reserveYN, senderYN, page, perPage, order, userID = '', queryString = '') ⇒ Object
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
|
# File 'lib/popbill/kakaotalk.rb', line 231
def search(corpNum, sDate, eDate, state, item, reserveYN, senderYN, page, perPage, order, userID = '', queryString ='')
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
raise PopbillException.new(-99999999, "시작일자가 입력되지 않았습니다.") if sDate.to_s == ''
raise PopbillException.new(-99999999, "종료일자가 입력되지 않았습니다.") if eDate.to_s == ''
uri = "/KakaoTalk/Search?SDate=#{sDate}&EDate=#{eDate}"
uri += "&State=" + state.join(',') if state.to_s != ''
uri += "&Item=" + item.join(',') if item.to_s != ''
uri += "&ReserveYN=" + reserveYN
uri += "&SenderYN=" + senderYN
uri += "&Page=" + page.to_s
uri += "&PerPage=" + perPage.to_s
uri += "&Order=" + order
if queryString.to_s != ''
uri += "&QString=" + queryString
end
httpget(URI.escape(uri), corpNum, userID)
end
|
#sendATS_multi(corpNum, templateCode, snd, altSendType, sndDT, msgs, requestNum = '', userID = '', btns = '') ⇒ Object
104
105
106
|
# File 'lib/popbill/kakaotalk.rb', line 104
def sendATS_multi(corpNum, templateCode, snd, altSendType, sndDT, msgs, requestNum = '', userID = '', btns = '')
sendATS_same(corpNum, templateCode, snd, "", "", altSendType, sndDT, msgs, requestNum, userID, btns)
end
|
#sendATS_one(corpNum, templateCode, snd, content, altContent, altSendType, sndDT, receiver, receiverName, requestNum = '', userID = '', btns = '') ⇒ Object
92
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/popbill/kakaotalk.rb', line 92
def sendATS_one(corpNum, templateCode, snd, content, altContent, altSendType, sndDT, receiver, receiverName, requestNum = '', userID = '', btns = '')
msg = [
{
"rcv" => receiver,
"rcvnm" => receiverName,
"msg" => content,
"altmsg" => altContent,
}
]
sendATS_same(corpNum, templateCode, snd, "", "", altSendType, sndDT, msg, requestNum, userID, btns)
end
|
#sendATS_same(corpNum, templateCode, snd, content, altContent, altSendType, sndDT, msgs, requestNum = '', userID = '', btns = '') ⇒ Object
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
# File 'lib/popbill/kakaotalk.rb', line 108
def sendATS_same(corpNum, templateCode, snd, content, altContent, altSendType, sndDT, msgs, requestNum = '', userID = '', btns = '')
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
raise PopbillException.new(-99999999, "알림톡 템플릿코드가 입력되지 않았습니다.") if templateCode.to_s == ''
raise PopbillException.new(-99999999, "발신번호가 입력되지 않았습니다.") if snd.to_s == ''
req = {}
req["templateCode"] = templateCode if templateCode.to_s != ''
req["snd"] = snd if snd.to_s != ''
req["content"] = content if content.to_s != ''
req["altContent"] = altContent if altContent.to_s != ''
req["altSendType"] = altSendType if altSendType.to_s != ''
req["sndDT"] = sndDT if sndDT.to_s != ''
req["requestNum"] = requestNum if requestNum.to_s != ''
req["msgs"] = msgs if msgs.to_s != ''
req["btns"] = btns if btns.to_s != ''
postData = req.to_json
httppost("/ATS", corpNum, postData, "", userID)
end
|
#sendFMS_multi(corpNum, plusFriendID, snd, altSendType, sndDT, filePath, imageURL, msgs, btns, adsYN = false, requestNum = '', userID = '') ⇒ Object
177
178
179
|
# File 'lib/popbill/kakaotalk.rb', line 177
def sendFMS_multi(corpNum, plusFriendID, snd, altSendType, sndDT, filePath, imageURL, msgs, btns, adsYN = false, requestNum = '', userID = '')
sendFMS_same(corpNum, plusFriendID, snd, "", "", altSendType, sndDT, filePath, imageURL, msgs, btns, adsYN, requestNum, userID)
end
|
#sendFMS_one(corpNum, plusFriendID, snd, content, altContent, altSendType, sndDT, filePath, imageURL, receiver, receiverName, btns, adsYN = false, requestNum = '', userID = '') ⇒ Object
165
166
167
168
169
170
171
172
173
174
175
|
# File 'lib/popbill/kakaotalk.rb', line 165
def sendFMS_one(corpNum, plusFriendID, snd, content, altContent, altSendType, sndDT, filePath, imageURL, receiver, receiverName, btns, adsYN = false, requestNum = '', userID = '')
msg = [
{
"rcv" => receiver,
"rcvnm" => receiverName,
"msg" => content,
"altmsg" => altContent,
}
]
sendFMS_same(corpNum, plusFriendID, snd, "", "", altSendType, sndDT, filePath, imageURL, msg, btns, adsYN, requestNum, userID)
end
|
#sendFMS_same(corpNum, plusFriendID, snd, content, altContent, altSendType, sndDT, filePath, imageURL, msgs, btns, adsYN = false, requestNum = '', userID = '') ⇒ Object
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
# File 'lib/popbill/kakaotalk.rb', line 181
def sendFMS_same(corpNum, plusFriendID, snd, content, altContent, altSendType, sndDT, filePath, imageURL, msgs, btns, adsYN = false, requestNum = '', userID = '')
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
raise PopbillException.new(-99999999, "플러스친구 아이디가 입력되지 않았습니다.") if plusFriendID.to_s == ''
raise PopbillException.new(-99999999, "발신번호가 입력되지 않았습니다.") if snd.to_s == ''
req = {}
req["plusFriendID"] = plusFriendID if plusFriendID.to_s != ''
req["snd"] = snd if snd.to_s != ''
req["content"] = content if content.to_s != ''
req["altContent"] = altContent if altContent.to_s != ''
req["altSendType"] = altSendType if altSendType.to_s != ''
req["sndDT"] = sndDT if sndDT.to_s != ''
req["imageURL"] = imageURL if imageURL.to_s != ''
req["msgs"] = msgs if msgs.to_s != ''
req["btns"] = btns if btns.to_s != ''
req["adsYN"] = adsYN if adsYN.to_s != ''
req["requestNum"] = requestNum if requestNum.to_s != ''
httppostfile("/FMS", corpNum, req, [filePath], userID)
end
|
#sendFTS_multi(corpNum, plusFriendID, snd, altSendType, sndDT, msgs, btns, adsYN = false, requestNum = '', userID = '') ⇒ Object
140
141
142
|
# File 'lib/popbill/kakaotalk.rb', line 140
def sendFTS_multi(corpNum, plusFriendID, snd, altSendType, sndDT, msgs, btns, adsYN = false, requestNum = '', userID = '')
sendFTS_same(corpNum, plusFriendID, snd, "", "", altSendType, sndDT, msgs, btns, adsYN, requestNum, userID)
end
|
#sendFTS_one(corpNum, plusFriendID, snd, content, altContent, altSendType, sndDT, receiver, receiverName, btns, adsYN = false, requestNum = '', userID = '') ⇒ Object
128
129
130
131
132
133
134
135
136
137
138
|
# File 'lib/popbill/kakaotalk.rb', line 128
def sendFTS_one(corpNum, plusFriendID, snd, content, altContent, altSendType, sndDT, receiver, receiverName, btns, adsYN = false, requestNum = '', userID = '')
msg = [
{
"rcv" => receiver,
"rcvnm" => receiverName,
"msg" => content,
"altmsg" => altContent,
}
]
sendFTS_same(corpNum, plusFriendID, snd, "", "", altSendType, sndDT, msg, btns, adsYN, requestNum, userID)
end
|
#sendFTS_same(corpNum, plusFriendID, snd, content, altContent, altSendType, sndDT, msgs, btns, adsYN = false, requestNum = '', userID = '') ⇒ Object
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
# File 'lib/popbill/kakaotalk.rb', line 144
def sendFTS_same(corpNum, plusFriendID, snd, content, altContent, altSendType, sndDT, msgs, btns, adsYN = false, requestNum = '', userID = '')
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
raise PopbillException.new(-99999999, "플러스친구 아이디가 입력되지 않았습니다.") if plusFriendID.to_s == ''
raise PopbillException.new(-99999999, "발신번호가 입력되지 않았습니다.") if snd.to_s == ''
req = {}
req["plusFriendID"] = plusFriendID if plusFriendID.to_s != ''
req["snd"] = snd if snd.to_s != ''
req["content"] = content if content.to_s != ''
req["altContent"] = altContent if altContent.to_s != ''
req["altSendType"] = altSendType if altSendType.to_s != ''
req["sndDT"] = sndDT if sndDT.to_s != ''
req["msgs"] = msgs if msgs.to_s != ''
req["btns"] = btns if btns.to_s != ''
req["adsYN"] = adsYN if adsYN.to_s != ''
req["requestNum"] = requestNum if requestNum.to_s != ''
postData = req.to_json
httppost("/FTS", corpNum, postData, "", userID)
end
|