stytch 0.1.12 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a852d901e8cc3975662612396da2bcd3578867bc5bd6f70742416892a109d18b
4
- data.tar.gz: 4e53ee2283a0adca79d27e1e5af96d6023eed27e034dc711085f725350ce2f9d
3
+ metadata.gz: 1e9f10372707e0a42d1501e1c0b6d115dd69eb1c6d2865dafb238062a7221dc3
4
+ data.tar.gz: 1ccf49b251bf88462be3fba3cd13db1ffe0a5fa6cdf36694bb05ce89bf8e1e83
5
5
  SHA512:
6
- metadata.gz: 853b94e64c62729198168eea85ca74f29f050f44bc03e2daa6dd5f409c4d9cd4abb5cf312f4d0861b0011ad2144f6ba597ba1c6730a57e3c30bd2fbbaa380e8e
7
- data.tar.gz: d08b198ab79cf15faeb1b82a4f796cb15194fc0da33df6d209f1c2f4cc966d2584e949cd366be2cadd38e38b30a244e06a7f909979ea3b414fb37c0456c18cad
6
+ metadata.gz: d3b8b523f0a345d2248ac79e97ef63b48929168005373653205d0a93bb2509f2f0037933579b1652dcf62d6e483069b702f1f1b4070fcb96a6a816b15e8fce1e
7
+ data.tar.gz: e1de3d40fe18440ce97279b64cf64d471d99c9464e1b7f174f2af62347e4f086285deb44123bd0a3e3c6a49a668f2ded1de34eb93ab333a0e9ec07e33c489c89
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Stytch
2
2
 
3
- Welcome to the offical Stytch ruby gem! This gem provides easy access to Stytch's API.
3
+ Welcome to the official Stytch ruby gem! This gem provides easy access to Stytch's API.
4
4
 
5
5
  ## Installation
6
6
 
data/lib/stytch/client.rb CHANGED
@@ -1,11 +1,9 @@
1
1
  require_relative 'endpoints/user'
2
- require_relative 'endpoints/email'
3
2
  require_relative 'endpoints/magic'
4
3
 
5
4
  module Stytch
6
5
  class Client
7
6
  include Stytch::Endpoints::User
8
- include Stytch::Endpoints::Email
9
7
  include Stytch::Endpoints::Magic
10
8
 
11
9
  ENVIRONMENTS = %i[live test].freeze
@@ -71,5 +69,17 @@ module Stytch
71
69
  path
72
70
  ).body
73
71
  end
72
+
73
+ def request_with_query_params(path, params)
74
+ request = path
75
+ params.compact.each_with_index do |p, i|
76
+ if i == 0
77
+ request += "?#{p[0].to_s}=#{p[1]}"
78
+ else
79
+ request += "&#{p[0].to_s}=#{p[1]}"
80
+ end
81
+ end
82
+ request
83
+ end
74
84
  end
75
85
  end
@@ -61,28 +61,6 @@ module Stytch
61
61
  post("#{PATH}/login_or_create", request)
62
62
  end
63
63
 
64
- def login_or_invite_by_email(
65
- email:,
66
- login_magic_link_url:,
67
- invite_magic_link_url:,
68
- login_expiration_minutes: nil,
69
- invite_expiration_minutes: nil,
70
- attributes: {}
71
- )
72
-
73
- request = {
74
- email: email,
75
- login_magic_link_url: login_magic_link_url,
76
- invite_magic_link_url: invite_magic_link_url,
77
- }
78
-
79
- request[:login_expiration_minutes] = login_expiration_minutes if login_expiration_minutes != nil
80
- request[:invite_expiration_minutes] = invite_expiration_minutes if invite_expiration_minutes != nil
81
- request[:attributes] = attributes if attributes != {}
82
-
83
- post("#{PATH}/login_or_invite", request)
84
- end
85
-
86
64
  def invite_by_email(
87
65
  email:,
88
66
  magic_link_url:,
@@ -7,8 +7,18 @@ module Stytch
7
7
  get("#{PATH}/#{user_id}")
8
8
  end
9
9
 
10
- def get_invited_users()
11
- get("#{PATH}/invites")
10
+ def get_pending_users(
11
+ limit: nil,
12
+ starting_after_id: nil
13
+ )
14
+ query_params = {
15
+ limit: limit,
16
+ starting_after_id: starting_after_id,
17
+ }
18
+
19
+ request = request_with_query_params("#{PATH}/pending", query_params)
20
+
21
+ get(request)
12
22
  end
13
23
 
14
24
  def create_user(
@@ -46,6 +56,13 @@ module Stytch
46
56
  delete("#{PATH}/#{user_id}")
47
57
  end
48
58
 
59
+ def delete_user_email(
60
+ user_id:,
61
+ email:
62
+ )
63
+ delete("#{PATH}/#{user_id}/emails/#{email}")
64
+ end
65
+
49
66
  private
50
67
 
51
68
  def format_emails(emails)
@@ -1,3 +1,3 @@
1
1
  module Stytch
2
- VERSION = "0.1.12"
2
+ VERSION = "0.1.17"
3
3
  end
data/stytch.gemspec CHANGED
@@ -23,6 +23,6 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
25
 
26
- spec.add_dependency 'faraday', '~> 1.1.0'
27
- spec.add_dependency 'faraday_middleware', '~> 1.0.0'
26
+ spec.add_dependency 'faraday', '>= 0.17.0', '< 2.0'
27
+ spec.add_dependency 'faraday_middleware', '>= 0.14.0', '< 2.0'
28
28
  end
metadata CHANGED
@@ -1,44 +1,56 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stytch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - alex-stytch
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-21 00:00:00.000000000 Z
11
+ date: 2021-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.1.0
19
+ version: 0.17.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 0.17.0
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: 1.1.0
32
+ version: '2.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: faraday_middleware
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - "~>"
37
+ - - ">="
32
38
  - !ruby/object:Gem::Version
33
- version: 1.0.0
39
+ version: 0.14.0
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '2.0'
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
- - - "~>"
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 0.14.0
50
+ - - "<"
39
51
  - !ruby/object:Gem::Version
40
- version: 1.0.0
41
- description:
52
+ version: '2.0'
53
+ description:
42
54
  email:
43
55
  - alex@stytch.com
44
56
  executables: []
@@ -57,7 +69,6 @@ files:
57
69
  - bin/setup
58
70
  - lib/stytch.rb
59
71
  - lib/stytch/client.rb
60
- - lib/stytch/endpoints/email.rb
61
72
  - lib/stytch/endpoints/magic.rb
62
73
  - lib/stytch/endpoints/user.rb
63
74
  - lib/stytch/middleware.rb
@@ -69,7 +80,7 @@ licenses:
69
80
  metadata:
70
81
  homepage_uri: https://stytch.com
71
82
  source_code_uri: https://github.com/stytchauth/stytch-ruby
72
- post_install_message:
83
+ post_install_message:
73
84
  rdoc_options: []
74
85
  require_paths:
75
86
  - lib
@@ -84,8 +95,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
95
  - !ruby/object:Gem::Version
85
96
  version: '0'
86
97
  requirements: []
87
- rubygems_version: 3.1.4
88
- signing_key:
98
+ rubygems_version: 3.0.3
99
+ signing_key:
89
100
  specification_version: 4
90
101
  summary: Stytch Ruby Gem
91
102
  test_files: []
@@ -1,11 +0,0 @@
1
- module Stytch
2
- module Endpoints
3
- module Email
4
- PATH = "/v1/emails".freeze
5
-
6
- def delete_email(user_id:, email_id:)
7
- delete("#{PATH}/#{email_id}/users/#{user_id}")
8
- end
9
- end
10
- end
11
- end