Module: OpConnect::Client::Items
- Included in:
- OpConnect::Client
- Defined in:
- lib/op_connect/client/items.rb
Instance Method Summary collapse
- #create_item(vault_id:, **attributes) ⇒ Object
- #delete_item(vault_id:, id:) ⇒ Object
- #get_item(vault_id:, id:) ⇒ Object (also: #item)
-
#list_items(vault_id:, **params) ⇒ <Type>
(also: #items)
Get a list of items from a vault.
- #replace_item(vault_id:, id:, **attributes) ⇒ Object
- #update_item(vault_id:, id:, **attributes) ⇒ Object
Instance Method Details
#create_item(vault_id:, **attributes) ⇒ Object
28 29 30 |
# File 'lib/op_connect/client/items.rb', line 28 def create_item(vault_id:, **attributes) Item.new post("vaults/#{vault_id}/items", body: attributes).body end |
#delete_item(vault_id:, id:) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/op_connect/client/items.rb', line 36 def delete_item(vault_id:, id:) return true if delete("vaults/#{vault_id}/items/#{id}").status == 204 false rescue OpConnect::Error false end |
#get_item(vault_id:, id:) ⇒ Object Also known as: item
23 24 25 |
# File 'lib/op_connect/client/items.rb', line 23 def get_item(vault_id:, id:) Item.new get("vaults/#{vault_id}/items/#{id}").body end |
#list_items(vault_id:, **params) ⇒ <Type> Also known as: items
Get a list of items from a vault.
18 19 20 |
# File 'lib/op_connect/client/items.rb', line 18 def list_items(vault_id:, **params) get("vaults/#{vault_id}/items", params: params).body.map { |item| Item.new(item) } end |