quickey_ruby_sdk 0.1.0 → 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: 9138797951a637252681fc73b3377055dafdc5e18ab5db100e40d8ef78b9e131
4
- data.tar.gz: e031f791665507011fc9832e9b2f4443e53a9416dd441124bf347bc2948fa0aa
3
+ metadata.gz: f837f6405e5ec0df097b7a543bb565b43d49f05707407bc3257d38fad5a481d8
4
+ data.tar.gz: 6862231b9634b1376e3ec5ecfc70e0229ab8e1139159dd8bd0bb866bc0fca652
5
5
  SHA512:
6
- metadata.gz: c68436c670b951c4462024ba980aa2f43d7be2a678885981b6528cd8416608c3c188843e5de279d93a79a09f368f7045ac8c9aeb07bb18a3a5128af31971c645
7
- data.tar.gz: 1fa7d32c85057ea5523b99804113c5ba7e2c44f40d76836589a390f46742ed671fb963f8b9822ae7a7ea97885186a0a133c5b100c141743f89055365a34e2a97
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
 
data/bin/console CHANGED
File without changes
data/bin/setup CHANGED
File without changes
@@ -1,27 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "quickey_ruby_sdk/version"
3
+ require_relative "quickey_ruby_sdk/app"
4
+ require_relative "quickey_ruby_sdk/auth"
4
5
  require_relative "quickey_ruby_sdk/config"
6
+ require_relative "quickey_ruby_sdk/version"
5
7
  require 'httparty'
6
8
  require 'json'
7
9
 
8
10
  module QuickeyRubySdk
9
- class App
10
- attr_reader :api_base
11
- attr_reader :api_key
12
-
13
- def initialize(api_key: nil)
14
- @api_key = api_key
15
- @api_base = QuickeyRubySdk::API_BASE
16
- end
17
-
18
- def getMetaData
19
- JSON.parse HTTParty.post(@api_base+"/auth/apiKey", body: { "apiKey": @api_key }).body
20
- end
11
+ class Sdk
12
+ attr_reader :app
13
+ attr_reader :auth
21
14
 
22
- def getAccessToken(email)
23
- response = JSON.parse HTTParty.post(@api_base+"/loginRegister", body: { "email": email }).body
24
- response["access_token"]
25
- end
26
- end
27
- end
15
+ def initialize(api_key: nil)
16
+ @app = QuickeyRubySdk::App.new(api_key: api_key)
17
+ @auth = QuickeyRubySdk::Auth.new(api_key: api_key)
18
+ end
19
+ end
@@ -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.0"
4
+ VERSION = "0.1.4"
5
5
  end
@@ -1,16 +1,17 @@
1
1
  # frozen_string_literal: true
2
-
3
- require_relative "lib/quickey_ruby_sdk/version"
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'quickey_ruby_sdk/version'
4
5
 
5
6
  Gem::Specification.new do |spec|
6
7
  spec.name = "quickey_ruby_sdk"
7
8
  spec.version = QuickeyRubySdk::VERSION
8
- spec.authors = ["efrizal"]
9
+ spec.authors = ["quickey team"]
9
10
  spec.email = ["efrizal@analisa.io"]
10
11
 
11
12
  spec.summary = 'SDK quickey for Ruby"'
12
13
  spec.description = 'A Login Management System for Application'
13
- spec.homepage = 'https://github.com/efrizal-analisa/quickey_ruby_sdk'
14
+ spec.homepage = 'https://docs.getquickey.com/ruby-sdk'
14
15
  spec.license = "MIT"
15
16
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
16
17
 
@@ -19,11 +20,11 @@ Gem::Specification.new do |spec|
19
20
 
20
21
  # Specify which files should be added to the gem when it is released.
21
22
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
23
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
24
+ f.match(%r{^(test|spec|features)/})
24
25
  end
25
26
  spec.bindir = "exe"
26
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
28
  spec.require_paths = ["lib"]
28
29
 
29
30
  # Uncomment to register a new dependency of your gem
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.0
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
- - efrizal
7
+ - quickey team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-14 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
@@ -68,21 +68,22 @@ files:
68
68
  - CHANGELOG.md
69
69
  - CODE_OF_CONDUCT.md
70
70
  - Gemfile
71
- - Gemfile.lock
72
71
  - LICENSE.txt
73
72
  - README.md
74
73
  - Rakefile
75
74
  - bin/console
76
75
  - bin/setup
77
76
  - lib/quickey_ruby_sdk.rb
77
+ - lib/quickey_ruby_sdk/app.rb
78
+ - lib/quickey_ruby_sdk/auth.rb
78
79
  - lib/quickey_ruby_sdk/config.rb
79
80
  - lib/quickey_ruby_sdk/version.rb
80
81
  - quickey_ruby_sdk.gemspec
81
- homepage: https://github.com/efrizal-analisa/quickey_ruby_sdk
82
+ homepage: https://docs.getquickey.com/ruby-sdk
82
83
  licenses:
83
84
  - MIT
84
85
  metadata:
85
- homepage_uri: https://github.com/efrizal-analisa/quickey_ruby_sdk
86
+ homepage_uri: https://docs.getquickey.com/ruby-sdk
86
87
  post_install_message:
87
88
  rdoc_options: []
88
89
  require_paths:
data/Gemfile.lock DELETED
@@ -1,65 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- quickey_ruby_sdk (0.1.0)
5
- httparty (~> 0.18.1)
6
- json (~> 2.5, >= 2.5.1)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- ast (2.4.2)
12
- diff-lcs (1.4.4)
13
- httparty (0.18.1)
14
- mime-types (~> 3.0)
15
- multi_xml (>= 0.5.2)
16
- json (2.5.1)
17
- mime-types (3.3.1)
18
- mime-types-data (~> 3.2015)
19
- mime-types-data (3.2021.0225)
20
- multi_xml (0.6.0)
21
- parallel (1.20.1)
22
- parser (3.0.1.1)
23
- ast (~> 2.4.1)
24
- rainbow (3.0.0)
25
- rake (13.0.3)
26
- regexp_parser (2.1.1)
27
- rexml (3.2.5)
28
- rspec (3.10.0)
29
- rspec-core (~> 3.10.0)
30
- rspec-expectations (~> 3.10.0)
31
- rspec-mocks (~> 3.10.0)
32
- rspec-core (3.10.1)
33
- rspec-support (~> 3.10.0)
34
- rspec-expectations (3.10.1)
35
- diff-lcs (>= 1.2.0, < 2.0)
36
- rspec-support (~> 3.10.0)
37
- rspec-mocks (3.10.2)
38
- diff-lcs (>= 1.2.0, < 2.0)
39
- rspec-support (~> 3.10.0)
40
- rspec-support (3.10.2)
41
- rubocop (1.16.1)
42
- parallel (~> 1.10)
43
- parser (>= 3.0.0.0)
44
- rainbow (>= 2.2.2, < 4.0)
45
- regexp_parser (>= 1.8, < 3.0)
46
- rexml
47
- rubocop-ast (>= 1.7.0, < 2.0)
48
- ruby-progressbar (~> 1.7)
49
- unicode-display_width (>= 1.4.0, < 3.0)
50
- rubocop-ast (1.7.0)
51
- parser (>= 3.0.1.1)
52
- ruby-progressbar (1.11.0)
53
- unicode-display_width (2.0.0)
54
-
55
- PLATFORMS
56
- x86_64-linux
57
-
58
- DEPENDENCIES
59
- quickey_ruby_sdk!
60
- rake (~> 13.0)
61
- rspec (~> 3.0)
62
- rubocop (~> 1.7)
63
-
64
- BUNDLED WITH
65
- 2.2.15