Class: Pluggy::Services::ItemService
- Inherits:
-
BaseService
- Object
- BaseService
- Pluggy::Services::ItemService
- Defined in:
- lib/pluggy/services/other_services.rb
Instance Method Summary collapse
-
#create(connector_id:, parameters:, **options) ⇒ Object
POST /items.
- #delete(id) ⇒ Object
-
#disable_auto_sync(id) ⇒ Object
PATCH, and it takes no body.
- #retrieve(id) ⇒ Object
-
#send_mfa(id, values) ⇒ Object
POST /items/id/mfa.
-
#update(id, **body) ⇒ Object
PATCH /items/id triggers a fresh sync, optionally updating credentials.
Methods inherited from BaseService
Constructor Details
This class inherits a constructor from Pluggy::Services::BaseService
Instance Method Details
#create(connector_id:, parameters:, **options) ⇒ Object
POST /items.
parameters is a connector-defined => String credential map
(or an encrypted string). Its keys are passed through untouched -- see
Util.encode_body's opaque handling -- because camelizing a credential
named "cpf_cnpj" would break item creation.
Never retried on failure: the API has no idempotency key, so a retry could open a duplicate connection.
93 94 95 96 97 98 99 |
# File 'lib/pluggy/services/other_services.rb', line 93 def create(connector_id:, parameters:, **) require_args!(connector_id: connector_id, parameters: parameters) object_request(:post, "/items", klass: Resources::Item, opaque: %w[parameters], body: { connector_id: connector_id, parameters: parameters, ** }) end |
#delete(id) ⇒ Object
113 114 115 116 |
# File 'lib/pluggy/services/other_services.rb', line 113 def delete(id) require_args!(id: id) object_request(:delete, "/items/#{id}", klass: Resources::Count) end |
#disable_auto_sync(id) ⇒ Object
PATCH, and it takes no body.
128 129 130 131 |
# File 'lib/pluggy/services/other_services.rb', line 128 def disable_auto_sync(id) require_args!(id: id) object_request(:patch, "/items/#{id}/disable-auto-sync", klass: Resources::Item) end |
#retrieve(id) ⇒ Object
101 102 103 104 |
# File 'lib/pluggy/services/other_services.rb', line 101 def retrieve(id) require_args!(id: id) object_request(:get, "/items/#{id}", klass: Resources::Item) end |
#send_mfa(id, values) ⇒ Object
POST /items/id/mfa. The body is a bare => value map, not a wrapped object, e.g. send_mfa(id, token: "123456").
120 121 122 123 124 125 |
# File 'lib/pluggy/services/other_services.rb', line 120 def send_mfa(id, values) require_args!(id: id, values: values) object_request(:post, "/items/#{id}/mfa", klass: Resources::Item, body: Util.stringify_keys(values.to_h)) end |
#update(id, **body) ⇒ Object
PATCH /items/id triggers a fresh sync, optionally updating credentials.
107 108 109 110 111 |
# File 'lib/pluggy/services/other_services.rb', line 107 def update(id, **body) require_args!(id: id) object_request(:patch, "/items/#{id}", klass: Resources::Item, opaque: %w[parameters], body: body) end |