quickey_ruby_sdk 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8aec13dfe97568bb871c862bb0a01521209ff8fd063c5de4c4884725a91af9e4
4
- data.tar.gz: 3fa58df776649ff36ffc547a059e3c79d121a70f25565f01bee2846cd64652a6
3
+ metadata.gz: f837f6405e5ec0df097b7a543bb565b43d49f05707407bc3257d38fad5a481d8
4
+ data.tar.gz: 6862231b9634b1376e3ec5ecfc70e0229ab8e1139159dd8bd0bb866bc0fca652
5
5
  SHA512:
6
- metadata.gz: 92520e6babd453df0df14da2e3d637d5c5bc9cbdfe880b314cf9390d5c13d630e3f092c01c88577618006c088410e4d7701a2ffab60bfffb8b51cf2c32799d1c
7
- data.tar.gz: 0a2eb70134dd49ad6c828a2049001186246f4e98e0697240a4019f0b237a826dc4e792cad6e8ed2f000dffffda7852ed11ccfc9513182c1942f6d6f8ff014d35
6
+ metadata.gz: ea6da444ae9de122852831d6ce6ec9e08df16fe6974dbe0e6fde3b030d47bcafee79bec8e42b3ca8b483d7f2c4d0edc8ffb92583eefe70b5a87ed95aab7579b2
7
+ data.tar.gz: 6a4c8c3eea68caf9973e09437d19d99e5f9207a0ce5888b09d88a5f8b1fef20184bd404c374fcd5c41ce673234f28aee582ed714a5ca95540d7a56a08fae490b
data/README.md CHANGED
@@ -23,23 +23,39 @@ Or install it yourself as:
23
23
  ```
24
24
  require 'quickey_ruby_sdk'
25
25
 
26
- quickey = QuickeyRubySdk::App.new(api_key: "YOUR API KEY")
26
+ quickey = QuickeyRubySdk::Sdk.new(api_key: "YOUR API KEY")
27
+ puts quickey.app.sendSMSOTP("+6282278894245", "smsOTP")
27
28
  ```
29
+
28
30
  ### Get App Data
29
31
  ```
30
- appData = quickey.getMetaData
32
+ appData = quickey.app.getMetaData
31
33
  puts appData
32
34
  ```
33
- ### Get Access Token
34
- ```
35
- accessToken = quickey.getAccessToken(appData["app"]["email"])
36
35
 
37
- or
36
+ ### Get Access Token By Email
37
+ ```
38
+ accessToken = quickey.auth.getAccessTokenByEmail("YOUR EMAIL", "YOUR PROVIDER") provider: "googleLogin" | "facebookLogin" | "linkedInLogin"
39
+ puts accessToken
40
+ ```
38
41
 
39
- accessToken = quickey.getAccessToken("YOUR APP EMAIL")
42
+ ### Get Access Token By Phone
43
+ ```
44
+ accessToken = quickey.auth.getAccessTokenByPhone("YOUR PHONE", "YOUR PROVIDER", "YOUR OTP CODE") provider: "smsOTP" | "waOTP"
40
45
  puts accessToken
41
46
  ```
42
47
 
48
+ ### Send SMS OTP To Phone
49
+ ```
50
+ response = quickey.app.sendSMSOTP("YOUR PHONE", "YOUR PROVIDER")
51
+ puts response
52
+ ```
53
+
54
+ ### Link Phone Number To Email
55
+ ```
56
+ response = quickey.auth.linkPhoneToEmail("YOUR PHONE", "YOUR ACCESS TOKEN BY EMAIL")
57
+ puts response
58
+ ```
43
59
 
44
60
 
45
61
  ## Development
@@ -50,7 +66,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
50
66
 
51
67
  ## Contributing
52
68
 
53
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/quickey_ruby_sdk. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/quickey_ruby_sdk/blob/master/CODE_OF_CONDUCT.md).
69
+ Bug reports and pull requests are welcome on GitHub at https://github.com/efrizal_analisa/quickey_ruby_sdk. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/quickey_ruby_sdk/blob/master/CODE_OF_CONDUCT.md).
54
70
 
55
71
  ## License
56
72
 
@@ -0,0 +1,30 @@
1
+ require 'httparty'
2
+ require 'json'
3
+
4
+ module QuickeyRubySdk
5
+ class App
6
+ attr_reader :api_base
7
+ attr_reader :api_key
8
+
9
+ def initialize(api_key: nil)
10
+ @api_key = api_key
11
+ @api_base = QuickeyRubySdk::API_BASE
12
+ end
13
+
14
+ def getMetaData
15
+ JSON.parse HTTParty.post(@api_base+"/auth/apiKey", body: { "apiKey": @api_key }).body
16
+ end
17
+
18
+ def sendSMSOTP(phone, provider)
19
+ response = JSON.parse HTTParty.post(@api_base+"/otp/sendToUserPhone",
20
+ body: {
21
+ "phone": phone,
22
+ "provider": provider
23
+ },
24
+ headers: {
25
+ "Authorization": @api_key
26
+ }).body
27
+ response
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,52 @@
1
+ require 'httparty'
2
+ require 'json'
3
+
4
+ module QuickeyRubySdk
5
+ class Auth
6
+ attr_reader :api_base
7
+ attr_reader :api_key
8
+
9
+ def initialize(api_key: nil)
10
+ @api_key = api_key
11
+ @api_base = QuickeyRubySdk::API_BASE
12
+ end
13
+
14
+ def getAccessTokenByEmail(email, provider)
15
+ response = JSON.parse HTTParty.post(@api_base+"/loginCustomer",
16
+ body: {
17
+ "email": email,
18
+ "provider": provider
19
+ },
20
+ headers: {
21
+ "Authorization": @api_key
22
+ }).body
23
+ response
24
+ end
25
+
26
+ def getAccessTokenByPhone(phone, provider, otpCode)
27
+ response = JSON.parse HTTParty.post(@api_base+"/loginCustomer",
28
+ body: {
29
+ "phone": phone,
30
+ "provider": provider,
31
+ "otpCode": otpCode
32
+ },
33
+ headers: {
34
+ "Authorization": @api_key
35
+ }).body
36
+ response
37
+ end
38
+
39
+
40
+ def linkPhoneToEmail(phone, provider)
41
+ response = JSON.parse HTTParty.post(@api_base+"/otp/linkToEmail",
42
+ body: {
43
+ "phone": phone,
44
+ "provider": provider
45
+ },
46
+ headers: {
47
+ "Authorization": @api_key
48
+ }).body
49
+ response
50
+ end
51
+ end
52
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module QuickeyRubySdk
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quickey_ruby_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - quickey team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-02 00:00:00.000000000 Z
11
+ date: 2021-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -74,6 +74,8 @@ files:
74
74
  - bin/console
75
75
  - bin/setup
76
76
  - lib/quickey_ruby_sdk.rb
77
+ - lib/quickey_ruby_sdk/app.rb
78
+ - lib/quickey_ruby_sdk/auth.rb
77
79
  - lib/quickey_ruby_sdk/config.rb
78
80
  - lib/quickey_ruby_sdk/version.rb
79
81
  - quickey_ruby_sdk.gemspec