Module: Stytch::RequestHelper
- Included in:
- CryptoWallets, M2M, M2M::Clients, M2M::Clients::Secrets, MagicLinks, MagicLinks::Email, OAuth, OTPs, OTPs::Email, OTPs::Sms, OTPs::Whatsapp, Passwords, Passwords::Email, Passwords::ExistingPassword, Passwords::Sessions, Project, Sessions, TOTPs, Users, WebAuthn, StytchB2B::Discovery, StytchB2B::Discovery::IntermediateSessions, StytchB2B::Discovery::Organizations, StytchB2B::MagicLinks, StytchB2B::MagicLinks::Discovery, StytchB2B::MagicLinks::Email, StytchB2B::MagicLinks::Email::Discovery, StytchB2B::OAuth, StytchB2B::OAuth::Discovery, StytchB2B::OTPs, StytchB2B::OTPs::Sms, StytchB2B::Organizations, StytchB2B::Organizations::Members, StytchB2B::Organizations::Members::OAuthProviders, StytchB2B::Passwords, StytchB2B::Passwords::Email, StytchB2B::Passwords::ExistingPassword, StytchB2B::Passwords::Sessions, StytchB2B::RBAC, StytchB2B::RecoveryCodes, StytchB2B::SCIM, StytchB2B::SCIM::Connection, StytchB2B::SSO, StytchB2B::SSO::OIDC, StytchB2B::SSO::SAML, StytchB2B::Sessions, StytchB2B::TOTPs
- Defined in:
- lib/stytch/request_helper.rb
Instance Method Summary collapse
- #delete_request(path, headers) ⇒ Object
- #get_request(path, headers) ⇒ Object
- #post_request(path, payload, headers) ⇒ Object
- #put_request(path, payload, headers) ⇒ Object
- #request_with_query_params(path, params) ⇒ Object
Instance Method Details
#delete_request(path, headers) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/stytch/request_helper.rb', line 28 def delete_request(path, headers) @connection.delete( path, headers ).body end |
#get_request(path, headers) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/stytch/request_helper.rb', line 5 def get_request(path, headers) @connection.get( path, headers ).body end |
#post_request(path, payload, headers) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/stytch/request_helper.rb', line 12 def post_request(path, payload, headers) @connection.post( path, payload, headers ).body end |
#put_request(path, payload, headers) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/stytch/request_helper.rb', line 20 def put_request(path, payload, headers) @connection.put( path, payload, headers ).body end |
#request_with_query_params(path, params) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/stytch/request_helper.rb', line 35 def request_with_query_params(path, params) request = path params.compact.each_with_index do |p, i| request += if i.zero? "?#{p[0]}=#{p[1]}" else "&#{p[0]}=#{p[1]}" end end request end |