Class: Pluggy::Services::ConnectTokenService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/pluggy/services/other_services.rb

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Constructor Details

This class inherits a constructor from Pluggy::Services::BaseService

Instance Method Details

#create(item_id: nil, options: nil) ⇒ Object

POST /connect_token.

Returns a 30-minute token for the Connect Widget in your frontend. It is not an apiKey and cannot authenticate API calls.

Pass item_id: to let the widget update an existing item instead of creating a new one.



201
202
203
204
205
206
207
208
209
# File 'lib/pluggy/services/other_services.rb', line 201

def create(item_id: nil, options: nil)
  body = {}
  body[:item_id] = item_id if item_id
  body[:options] = options if options

  object_request(:post, "/connect_token",
    klass: Resources::ConnectToken,
    body: body.empty? ? nil : body)
end