minty 1.0.0 → 1.0.1

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: 7c4937d043506771b524e4ca14acfcf5fa30bcd141b2a0e6bb6cbb16840bd845
4
- data.tar.gz: 4da3f2a001aa8633abe790d90669e159642245cb42b199855836cdf8e7e00851
3
+ metadata.gz: b0c9e9f92d106139eef7a403d2aa557686e9c45baf402ce293eddbfa2e1b7850
4
+ data.tar.gz: 67fa0301318d1a8f61e1b6bcc511cac063e18a863d1f29fa815a83cb96144a9b
5
5
  SHA512:
6
- metadata.gz: 600c76679a2131f77221338fcfe3e54d9a4a335ddbb9ec7cb0d2bbf4fbafff5c051c67d3e067444f9cf7bee31edb621ae724077475d349d6602b7edd4932a691
7
- data.tar.gz: 00c0acd3dd87c681ba0af9abc7248b53d80c0afb5f0cc6e7171d3fe4eba84acc3762c596a447b2b3ea526c0a410debd25ea342ce49c0c47e3069fc23058e4f65
6
+ metadata.gz: 98b3c9ce3bd30445ba41a7eb58765d2b2347bd81fe65912abc55af0d84b6db9af170f2daaa159f9946f7bf0eca2137d20f72c334dfa739846b75e39b37f82859
7
+ data.tar.gz: 7730bc78bbc6a7ac538db19d65c1e1823cba8e27c6da46e6c5b5aa63d8722f292690c7cd1a69b4b510f8a0e6de9d96cced75a3e4cd4e153d6eb494ed1482bfa1
@@ -5,21 +5,46 @@ require 'jwt'
5
5
  module Minty
6
6
  module Api
7
7
  module AuthenticationEndpoints
8
- def sign_in_url(client_id: @client_id, client_secret: @client_secret, organization: @organization)
8
+ def sign_in_url
9
9
  response = request_with_retry(:get, '/sign_in_url')
10
10
  response['redirect_url']
11
11
  end
12
12
 
13
- def sign_up_url(client_id: @client_id, client_secret: @client_secret, organization: @organization)
13
+ def sign_up_url
14
14
  response = request_with_retry(:get, '/sign_up_url')
15
15
  response['redirect_url']
16
16
  end
17
17
 
18
- def forgot_password_url(client_id: @client_id, client_secret: @client_secret, organization: @organization)
18
+ def forgot_password_url
19
19
  response = request_with_retry(:get, '/forgot_password_url')
20
20
  response['redirect_url']
21
21
  end
22
22
 
23
+ def sign_in(email, password)
24
+ request_with_retry(:post, '/sign_in', { email: email, password: password })
25
+ end
26
+
27
+ def sign_up(name, email, password)
28
+ request_with_retry(:post, '/sign_up', { name: name, email: email, password: password })
29
+ end
30
+
31
+ def sign_out(token)
32
+ request_with_retry(:delete, '/sign_out', { token: token })
33
+ end
34
+
35
+ def forgot_password(email)
36
+ request_with_retry(:post, '/forgot_password', { email: email })
37
+ end
38
+
39
+ def validate_token(token)
40
+ request_with_retry(:get, '/validate_token', { token: token })
41
+ end
42
+
43
+ def application_user(token)
44
+ response = request_with_retry(:get, '/application_user', { token: token })
45
+ response['application_user']
46
+ end
47
+
23
48
  private
24
49
 
25
50
  def to_query(hash)
@@ -11,13 +11,21 @@ module Minty
11
11
  end
12
12
 
13
13
  class HTTPError < Minty::Exception
14
- def headers
14
+ def http_headers
15
15
  error_data[:headers]
16
16
  end
17
17
 
18
18
  def http_code
19
19
  error_data[:code]
20
20
  end
21
+
22
+ def http_response
23
+ JSON.parse(to_s)
24
+ end
25
+
26
+ def message
27
+ http_response['message']
28
+ end
21
29
  end
22
30
 
23
31
  class Unauthorized < Minty::HTTPError; end
data/lib/minty/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Minty
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minty
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-11 00:00:00.000000000 Z
11
+ date: 2022-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client