linkhub 1.3.1 → 1.4.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.
- checksums.yaml +4 -4
- data/lib/linkhub.rb +26 -16
- 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: d4e0ef8517b6f56311b735b2533a1f907b662ca4
|
4
|
+
data.tar.gz: 6d132d61f632cde4572af03059f17ed44aed4ce7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77cea59a932b20aa797ea9706c7beb76db167db55e201deac13746e2e4b6a84f6b1ee5aeeadec084ceb493cf9065e3a8bf94ba6af98e89a7f0548688c852aefe
|
7
|
+
data.tar.gz: ece7ed9bf9529187f0c0ced32ad5636586c81bbd2d96c0fba289ccff498df28f42cca9e2cb3554ac3d2d7ded28d0e4bdf93c1b4664a4d81793f7aaeeeaca258d
|
data/lib/linkhub.rb
CHANGED
@@ -12,10 +12,10 @@ require 'openssl'
|
|
12
12
|
class Linkhub
|
13
13
|
attr_accessor :_linkID, :_secretKey
|
14
14
|
|
15
|
-
LINKHUB_APIVersion = "
|
15
|
+
LINKHUB_APIVersion = "2.0"
|
16
16
|
LINKHUB_ServiceURL = "https://auth.linkhub.co.kr"
|
17
|
+
LINKHUB_ServiceURL_Static = "https://static-auth.linkhub.co.kr"
|
17
18
|
LINKHUB_ServiceURL_GA = "https://ga-auth.linkhub.co.kr"
|
18
|
-
|
19
19
|
# Generate Linkhub Class Singleton Instance
|
20
20
|
class << self
|
21
21
|
def instance(linkID, secretKey)
|
@@ -27,16 +27,26 @@ class Linkhub
|
|
27
27
|
private :new
|
28
28
|
end
|
29
29
|
|
30
|
+
def getServiceURL(useStaticIP, useGAIP)
|
31
|
+
if useGAIP
|
32
|
+
return LINKHUB_ServiceURL_GA
|
33
|
+
elsif useStaticIP
|
34
|
+
return LINKHUB_ServiceURL_Static
|
35
|
+
else
|
36
|
+
return LINKHUB_ServiceURL
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
30
40
|
# Get SessionToken for Bearer Token
|
31
|
-
def getSessionToken(serviceid, accessid, scope, forwardip="",useStaticIP=false)
|
32
|
-
uri = URI(
|
41
|
+
def getSessionToken(serviceid, accessid, scope, forwardip="",useStaticIP=false,useGAIP=false)
|
42
|
+
uri = URI(getServiceURL(useStaticIP, useGAIP) + "/" + serviceid + "/Token")
|
33
43
|
|
34
44
|
postData = {:access_id => accessid, :scope => scope}.to_json
|
35
45
|
|
36
|
-
apiServerTime = getTime(useStaticIP)
|
46
|
+
apiServerTime = getTime(useStaticIP, useGAIP)
|
37
47
|
|
38
48
|
hmacTarget = "POST\n"
|
39
|
-
hmacTarget += Base64.strict_encode64(Digest::
|
49
|
+
hmacTarget += Base64.strict_encode64(Digest::SHA256.digest(postData)) + "\n"
|
40
50
|
hmacTarget += apiServerTime + "\n"
|
41
51
|
|
42
52
|
if forwardip != ""
|
@@ -49,7 +59,7 @@ class Linkhub
|
|
49
59
|
key = Base64.decode64(@_secretKey)
|
50
60
|
|
51
61
|
data = hmacTarget
|
52
|
-
digest = OpenSSL::Digest.new("
|
62
|
+
digest = OpenSSL::Digest.new("sha256")
|
53
63
|
hmac = Base64.strict_encode64(OpenSSL::HMAC.digest(digest, key, data))
|
54
64
|
|
55
65
|
headers = {
|
@@ -85,9 +95,9 @@ class Linkhub
|
|
85
95
|
|
86
96
|
|
87
97
|
# Get API Server UTC Time
|
88
|
-
def getTime(useStaticIP=false)
|
89
|
-
uri = URI((useStaticIP
|
90
|
-
|
98
|
+
def getTime(useStaticIP=false,useGAIP=false)
|
99
|
+
uri = URI(getServiceURL(useStaticIP, useGAIP) + "/Time")
|
100
|
+
|
91
101
|
res = Net::HTTP.get_response(uri)
|
92
102
|
|
93
103
|
if res.code == "200"
|
@@ -99,8 +109,8 @@ class Linkhub
|
|
99
109
|
end
|
100
110
|
|
101
111
|
# 파트너 포인트 충전 URL - 2017/08/29 추가
|
102
|
-
def getPartnerURL(bearerToken, serviceID, togo, useStaticIP=false)
|
103
|
-
uri = URI((useStaticIP
|
112
|
+
def getPartnerURL(bearerToken, serviceID, togo, useStaticIP=false, useGAIP=false)
|
113
|
+
uri = URI(getServiceURL(useStaticIP, useGAIP) + "/" + serviceID + "/URL?TG=" + togo)
|
104
114
|
|
105
115
|
headers = {
|
106
116
|
"Authorization" => "Bearer " + bearerToken,
|
@@ -121,8 +131,8 @@ class Linkhub
|
|
121
131
|
end
|
122
132
|
|
123
133
|
# Get Popbill member remain point
|
124
|
-
def getBalance(bearerToken, serviceID, useStaticIP=false)
|
125
|
-
uri = URI((useStaticIP
|
134
|
+
def getBalance(bearerToken, serviceID, useStaticIP=false, useGAIP=false)
|
135
|
+
uri = URI(getServiceURL(useStaticIP, useGAIP) + "/" + serviceID + "/Point")
|
126
136
|
|
127
137
|
headers = {
|
128
138
|
"Authorization" => "Bearer " + bearerToken,
|
@@ -143,8 +153,8 @@ class Linkhub
|
|
143
153
|
end
|
144
154
|
|
145
155
|
# Get Linkhub partner remain point
|
146
|
-
def getPartnerBalance(bearerToken, serviceID, useStaticIP)
|
147
|
-
uri = URI(
|
156
|
+
def getPartnerBalance(bearerToken, serviceID, useStaticIP, useGAIP=false)
|
157
|
+
uri = URI(getServiceURL(useStaticIP, useGAIP) + "/" + serviceID + "/PartnerPoint")
|
148
158
|
|
149
159
|
headers = {
|
150
160
|
"Authorization" => "Bearer " + bearerToken,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linkhub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Linkhub Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Linkhub API SDK
|
14
14
|
email: code@linkhub.co.kr
|