Class: Sendly::SessionsResource

Inherits:
Object
  • Object
show all
Defined in:
lib/sendly/verify.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ SessionsResource

Returns a new instance of SessionsResource.



141
142
143
# File 'lib/sendly/verify.rb', line 141

def initialize(client)
  @client = client
end

Instance Method Details

#create(success_url:, cancel_url: nil, brand_name: nil, brand_color: nil, metadata: nil) ⇒ Object



145
146
147
148
149
150
151
152
153
154
# File 'lib/sendly/verify.rb', line 145

def create(success_url:, cancel_url: nil, brand_name: nil, brand_color: nil, metadata: nil)
  body = { success_url: success_url }
  body[:cancel_url] = cancel_url if cancel_url
  body[:brand_name] = brand_name if brand_name
  body[:brand_color] = brand_color if brand_color
  body[:metadata] =  if 

  response = @client.post("/verify/sessions", body)
  VerifySession.new(response)
end

#validate(token:) ⇒ Object



156
157
158
159
# File 'lib/sendly/verify.rb', line 156

def validate(token:)
  response = @client.post("/verify/sessions/validate", { token: token })
  ValidateSessionResponse.new(response)
end