kakao_msg 0.0.11 → 0.1.0

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/kakao_msg.rb +21 -18
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0047beec0649adaa4e08704097fa0d8bd8d8c7becb7f8a6538f60aeedcadf150
4
- data.tar.gz: 80761b122a31afa3712adce923b5a477389b61f56c55f1a6c9c01a4d3780798a
3
+ metadata.gz: 781638fa12c386c3ec7c53011ce9065920d51ad71be3474f54ec7617b1eccd92
4
+ data.tar.gz: 38a4b709a31608d469a2f0c80bd46c722035b089a23ff5b7b702070497f64508
5
5
  SHA512:
6
- metadata.gz: 5e745b14b848f0a93bc7b3334648f9c4c6eec71fe360eb7d0af26940fe891838cd1ed3381b80ad6f5ed1bed21eede4efd36a15958b8688139c305137e178df7c
7
- data.tar.gz: f902944f574c9de5e1496581440a20495fbc317d9e2ff7490e931a56059c69d7c31e66b9650dc9c6f2a9d7a6c7c39027d7b4db80949109d1c3f0adb1de72b6d3
6
+ metadata.gz: 603f9a14334030139aecb0da7f9a1717085a4eb3b0cbba61320b3d9cd538897c643e34eed25e5aee1a2339e52fcc4334e99fdb024f541828ef97e13502ebaf9b
7
+ data.tar.gz: 179815efcf32e6bcac290d385e29487cbed43fac77ee0bd0053711e6cba88ba3c6a9cf4d11164e53a6a20250d9dff22632c4f8f71e7562a457b596cfc4dd82e8
data/lib/kakao_msg.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'net/http'
2
+ require 'net/https'
2
3
  require 'json'
3
4
 
4
5
  class KakaoMsg
@@ -10,28 +11,30 @@ class KakaoMsg
10
11
  def send(
11
12
  phone:, msg:, tmpl_id:
12
13
  )
13
- url = URI.parse("https://alimtalk-api.bizmsg.kr/v2/sender/send")
14
+ uri = URI.parse("https://alimtalk-api.bizmsg.kr/v2/sender/send")
14
15
 
15
- http = Net::HTTP.new(url.host, url.port)
16
- http.use_ssl = true
17
- http.ssl_version = :TLSv1
18
-
19
- data = {
20
- message_type: "AT",
21
- phn: phone,
22
- profile: @profile,
23
- reserveDt: "00000000000000",
24
- msg: msg,
25
- tmplId: tmpl_id
16
+ header = {
17
+ 'Content-type': 'application/json',
18
+ 'userid': 'spacebird'
26
19
  }
20
+ data = [
21
+ {
22
+ message_type: "AT",
23
+ phn: phone,
24
+ profile: @profile,
25
+ reserveDt: "00000000000000",
26
+ msg: msg,
27
+ tmplId: tmpl_id
28
+ }
29
+ ]
30
+ request = Net::HTTP::Post.new(uri.path, header)
31
+ request.body = data.to_json
27
32
 
28
- headers = {
29
- 'Content-Type': 'application/json',
30
- 'userid': @user_id
31
- }
33
+ http = Net::HTTP.new(uri.host, uri.port)
34
+ http.use_ssl = true
32
35
 
33
- res = http.post(url.path, data.to_json, headers)
36
+ response = http.request(request)
34
37
 
35
- return res
38
+ return response
36
39
  end
37
40
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kakao_msg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - lee soo hyeon
@@ -10,7 +10,7 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2020-03-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: send kakaotalk msg
13
+ description: send kakaotalk msg gem for bizm
14
14
  email: lsh59727@gmail.com
15
15
  executables: []
16
16
  extensions: []