kth-alimtalk 0.1.6 → 0.1.7
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 +4 -4
- data/README.md +69 -5
- data/lib/kth/alimtalk/version.rb +1 -1
- data/lib/kth/alimtalk.rb +16 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32c7e0ab55cd53ef5cd15079ae4a3f40d9d3630c
|
4
|
+
data.tar.gz: 91a8c007c57a04d433effdd08e1f2124a2d60c8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 918c4ee819df53f2ca0a4e83d389a6538a75432e8b10118124dcd732588e7296569c4a0d961fa1e9238e3d15915dd5bf703449a1953488ea5ca74c6a3810a209
|
7
|
+
data.tar.gz: 2dde03ecd93115b5377c813ea8f9b33ea6378ba559040850c4c826e8cda09aa115a3758b83e39c2628748826f5ec2608c0fb7bde8b41026a61969f386820cd0a
|
data/README.md
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
# Kth::Alimtalk
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
3
|
+
API스토어(https://www.apistore.co.kr/api/apiViewPrice.do?service_seq=558)에서 제공하는 카카오톡 알림톡 API를 구현한 gem.
|
7
4
|
## Installation
|
8
5
|
|
9
6
|
Add this line to your application's Gemfile:
|
@@ -22,7 +19,74 @@ Or install it yourself as:
|
|
22
19
|
|
23
20
|
## Usage
|
24
21
|
|
25
|
-
|
22
|
+
Create a client variable with your "API스토어ID" and "API Store Key".
|
23
|
+
```ruby
|
24
|
+
c = Kth::Alimtalk::Client.new("API스토어ID", "API STORE KEY")
|
25
|
+
```
|
26
|
+
|
27
|
+
### 알림톡 발송
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
# phone_number: 수신할 핸드폰 번호
|
31
|
+
# callback: 발신자 전화번호
|
32
|
+
# msg: 전송할 메세지
|
33
|
+
# template_code: 카카오톡 알림톡 템플릿 코드
|
34
|
+
# failed_type: 전송 실패시 발송할 메세지 형태 (ex. SMS, LMS, N)
|
35
|
+
# options: {
|
36
|
+
# request_date: 발송시간 (Time.new(2017, 07, 17, 19, 00, 00))
|
37
|
+
# url: 알림톡 버튼 타입 URL (승인된 template 과 불일치시 전송실패)
|
38
|
+
# url_button_text: 알림톡 버튼 타입 버튼 TEXT (승인된 template과 불일치시 전송실패)
|
39
|
+
# failed_subject: 카카오알림톡 전송 실패 시 전송할 제목 (SMS 미사용)
|
40
|
+
# failed_msg: 카카오알림톡 전송 실패 시 전송할 내용
|
41
|
+
# params['REQDATE'] = options['request_date'].strftime("%Y%m%d%H%M%S") if options['request_date']
|
42
|
+
# }
|
43
|
+
c.send_message(phone_number, callback, msg, template_code, failed_type, options)
|
44
|
+
```
|
45
|
+
|
46
|
+
### 리포트 조회
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
# cmid: 서버에서 생성한 request를 식별할 수 있는 유일한 키
|
50
|
+
c.report(cmid)
|
51
|
+
```
|
52
|
+
|
53
|
+
### 템플릿 조회
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
# options: {
|
57
|
+
# template_code: 템플릿코드 – 입력 안 할경우 전체 리스트 반환
|
58
|
+
# status: 검수상태 – 입력 안 할경우 전체 리스트 반 환
|
59
|
+
# 등록(1) / 검수요청(2)
|
60
|
+
# 승인(3) / 반려(4) / 승인중단(5)
|
61
|
+
# }
|
62
|
+
c.templates(options)
|
63
|
+
```
|
64
|
+
|
65
|
+
### 발신번호 인증/등록
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
# send_phone_number: 등록할 발신 번호
|
69
|
+
# comment: 메모 (200자)
|
70
|
+
# pin_type: 인증방법 (SMS. VMS 중 1개 선택)
|
71
|
+
c.register_callback(send_phone_number, comment, pin_type)
|
72
|
+
|
73
|
+
|
74
|
+
# 인증번호 확인 후
|
75
|
+
|
76
|
+
# send_phone_number: 등록할 발신 번호
|
77
|
+
# comment: 메모 (200자)
|
78
|
+
# pin_type: 인증방법 (SMS. VMS 중 1개 선택)
|
79
|
+
# pin_code: 인증번호 (SMS 인증번호(6자리), VMS인증번호 (2자리))
|
80
|
+
c.verify_callback(send_phone_number, comment, pin_type, pin_code)
|
81
|
+
```
|
82
|
+
|
83
|
+
### 발신번호 리스트 조회
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
# send_phone_number: 발신번호(“-“제외) – 입력 안 할경우 전체 리 스트 반환
|
87
|
+
c.callbacks(send_phone_number)
|
88
|
+
```
|
89
|
+
|
26
90
|
|
27
91
|
## Development
|
28
92
|
|
data/lib/kth/alimtalk/version.rb
CHANGED
data/lib/kth/alimtalk.rb
CHANGED
@@ -41,7 +41,7 @@ module Kth
|
|
41
41
|
send_get_request request_url
|
42
42
|
end
|
43
43
|
|
44
|
-
def templates(options)
|
44
|
+
def templates(options = {})
|
45
45
|
request_url = "/kko/1/tamplate/list/#{client_id}?"
|
46
46
|
if options.present?
|
47
47
|
request_url += "TEMPLATE_CODE=##{options['template_code']}&" if options['template_code']
|
@@ -53,16 +53,27 @@ module Kth
|
|
53
53
|
|
54
54
|
def register_callback(send_phone_number, comment, pin_type = 'SMS')
|
55
55
|
phone_number = send_phone_number.gsub("-", "")
|
56
|
-
request_url = "/kko/1/sendnumber/save/#{client_id}
|
56
|
+
request_url = "/kko/1/sendnumber/save/#{client_id}"
|
57
|
+
params = {
|
58
|
+
'sendnumber' => phone_number,
|
59
|
+
'comment' => comment,
|
60
|
+
'pintype' => pin_type
|
61
|
+
}
|
57
62
|
|
58
|
-
|
63
|
+
send_post_request request_url, params
|
59
64
|
end
|
60
65
|
|
61
66
|
def verify_callback(send_phone_number, comment, pin_type, pin_code)
|
62
67
|
phone_number = send_phone_number.gsub("-", "")
|
63
|
-
request_url = "/kko/1/sendnumber/save/#{client_id}
|
68
|
+
request_url = "/kko/1/sendnumber/save/#{client_id}"
|
69
|
+
params = {
|
70
|
+
'sendnumber' => phone_number,
|
71
|
+
'comment' => comment,
|
72
|
+
'pintype' => pin_type,
|
73
|
+
'pincode' => pin_code
|
74
|
+
}
|
64
75
|
|
65
|
-
|
76
|
+
send_post_request request_url, params
|
66
77
|
end
|
67
78
|
|
68
79
|
def callbacks(send_phone_number = '')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kth-alimtalk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyoungwon Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|