From 41f0eb72a29ef53d6eb4bfd6e9f93c48b7346ca2 Mon Sep 17 00:00:00 2001 From: Alexander Olofsson <alexander.olofsson@liu.se> Date: Thu, 5 Dec 2019 14:28:53 +0100 Subject: [PATCH] Modify resource list creation to be more obvious --- lib/passwordstate/client.rb | 12 ++++++++---- lib/passwordstate/resource_list.rb | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/passwordstate/client.rb b/lib/passwordstate/client.rb index 1153aae..b8a5da6 100644 --- a/lib/passwordstate/client.rb +++ b/lib/passwordstate/client.rb @@ -35,21 +35,25 @@ module Passwordstate end def folders - ResourceList.new self, Passwordstate::Resources::Folder, + ResourceList.new Passwordstate::Resources::Folder, + client: self, only: %i[all search post] end def hosts - ResourceList.new self, Passwordstate::Resources::Host, + ResourceList.new Passwordstate::Resources::Host, + client: self, except: %i[search put] end def passwords - ResourceList.new self, Passwordstate::Resources::Password + ResourceList.new Passwordstate::Resources::Password, + client: self end def password_lists - ResourceList.new self, Passwordstate::Resources::PasswordList, + ResourceList.new Passwordstate::Resources::PasswordList, + client: self, except: %i[put delete] end diff --git a/lib/passwordstate/resource_list.rb b/lib/passwordstate/resource_list.rb index 2727b69..2ce77e3 100644 --- a/lib/passwordstate/resource_list.rb +++ b/lib/passwordstate/resource_list.rb @@ -28,7 +28,7 @@ module Passwordstate attr_reader :client, :resource, :options - def initialize(client, resource, options = {}) + def initialize(resource, client:, **options) @client = client @resource = resource @loaded = false -- GitLab