From 92c2113b3c29f922ec4f9549546ecfd3e3634bda Mon Sep 17 00:00:00 2001 From: Auston Bunsen Date: Wed, 25 Mar 2026 23:28:04 -0700 Subject: [PATCH 1/5] Fix create_template to accept flat params matching API docs The transform_template_params method was overwriting flat params with nil values from empty nested hashes. Now it only merges nested design/ support_info keys when they are actually provided, while still accepting flat params as shown in the API documentation. --- README.md | 28 +++++++++++++--------------- lib/accessgrid/console.rb | 21 ++++++++------------- spec/console_spec.rb | 37 ++++++++++++++++--------------------- 3 files changed, 37 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 4424de9..3dd0c12 100644 --- a/README.md +++ b/README.md @@ -127,26 +127,24 @@ client.access_cards.delete("0xc4rd1d") ```ruby template = client.console.create_template( - name: "Employee NFC key", + name: "Employee Access Pass", platform: "apple", use_case: "employee_badge", protocol: "desfire", + allow_on_multiple_devices: true, watch_count: 2, iphone_count: 3, - design: { - background_color: "#FFFFFF", - label_color: "#000000", - label_secondary_color: "#333333", - background_image: "[image_in_base64_encoded_format]", - logo_image: "[image_in_base64_encoded_format]", - icon_image: "[image_in_base64_encoded_format]" - }, - support_info: { - support_url: "https://help.yourcompany.com", - support_phone_number: "+1-555-123-4567", - support_email: "support@yourcompany.com", - privacy_policy_url: "https://yourcompany.com/privacy", - terms_and_conditions_url: "https://yourcompany.com/terms" + background_color: "#FFFFFF", + label_color: "#000000", + label_secondary_color: "#333333", + support_url: "https://help.yourcompany.com", + support_phone_number: "+1-555-123-4567", + support_email: "support@yourcompany.com", + privacy_policy_url: "https://yourcompany.com/privacy", + terms_and_conditions_url: "https://yourcompany.com/terms", + metadata: { + version: "2.1", + approval_status: "approved" } ) ``` diff --git a/lib/accessgrid/console.rb b/lib/accessgrid/console.rb index dde3b78..0c71b07 100644 --- a/lib/accessgrid/console.rb +++ b/lib/accessgrid/console.rb @@ -64,19 +64,14 @@ def list_ledger_items(params = {}) private def transform_template_params(params) - design = params.delete(:design) || {} - support_info = params.delete(:support_info) || {} - - params.merge( - background_color: design[:background_color], - label_color: design[:label_color], - label_secondary_color: design[:label_secondary_color], - support_url: support_info[:support_url], - support_phone_number: support_info[:support_phone_number], - support_email: support_info[:support_email], - privacy_policy_url: support_info[:privacy_policy_url], - terms_and_conditions_url: support_info[:terms_and_conditions_url] - ) + design = params.delete(:design) + support_info = params.delete(:support_info) + + # Only merge nested keys if they were provided (backward compat) + params.merge!(design) if design + params.merge!(support_info) if support_info + + params end end diff --git a/spec/console_spec.rb b/spec/console_spec.rb index 6328ace..cd0d5e3 100644 --- a/spec/console_spec.rb +++ b/spec/console_spec.rb @@ -88,22 +88,24 @@ expect { console.create_template(template_params) }.not_to raise_error end - it 'handles missing design and support_info' do - minimal_params = { name: 'Minimal Template', platform: 'apple' } - minimal_request_body = { - name: 'Minimal Template', + it 'handles flat params without nested design/support_info' do + flat_params = { + name: 'Flat Template', platform: 'apple', - background_color: nil, - label_color: nil, - label_secondary_color: nil, - support_url: nil, - support_email: nil, - support_phone_number: nil, - privacy_policy_url: nil, - terms_and_conditions_url: nil + background_color: '#FFFFFF', + support_url: 'https://help.example.com' } - stub_api_request(:post, '/v1/console/card-templates', body: success_response, request_body: minimal_request_body) + stub_api_request(:post, '/v1/console/card-templates', body: success_response, request_body: flat_params) + + template = console.create_template(flat_params) + expect(template).to be_a(AccessGrid::Template) + end + + it 'handles minimal params' do + minimal_params = { name: 'Minimal Template', platform: 'apple' } + + stub_api_request(:post, '/v1/console/card-templates', body: success_response, request_body: minimal_params) template = console.create_template(minimal_params) expect(template).to be_a(AccessGrid::Template) @@ -125,14 +127,7 @@ { name: 'Updated Badge', watch_count: 3, - background_color: nil, - label_color: nil, - label_secondary_color: nil, - support_url: nil, - support_email: 'new-support@example.com', - support_phone_number: nil, - privacy_policy_url: nil, - terms_and_conditions_url: nil + support_email: 'new-support@example.com' } end From f7440c6e7b6bf6a4f48686230963f2083c67851f Mon Sep 17 00:00:00 2001 From: Auston Bunsen Date: Wed, 25 Mar 2026 23:33:12 -0700 Subject: [PATCH 2/5] Add feature matrix to README --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 3dd0c12..50da2a1 100644 --- a/README.md +++ b/README.md @@ -296,6 +296,32 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run Bug reports and pull requests are welcome on GitHub at https://github.com/access-grid/accessgrid-rb. +## Feature Matrix + +| Endpoint | Method | Supported | +|---|---|:---:| +| POST /v1/key-cards | `access_cards.issue()` | Y | +| GET /v1/key-cards/{id} | `access_cards.get()` | Y | +| PATCH /v1/key-cards/{id} | `access_cards.update()` | Y | +| GET /v1/key-cards | `access_cards.list()` | Y | +| POST /v1/key-cards/{id}/suspend | `access_cards.suspend()` | Y | +| POST /v1/key-cards/{id}/resume | `access_cards.resume()` | Y | +| POST /v1/key-cards/{id}/unlink | `access_cards.unlink()` | Y | +| POST /v1/key-cards/{id}/delete | `access_cards.delete()` | Y | +| POST /v1/console/card-templates | `console.create_template()` | Y | +| PUT /v1/console/card-templates/{id} | `console.update_template()` | Y | +| GET /v1/console/card-templates/{id} | `console.read_template()` | Y | +| GET /v1/console/card-templates/{id}/logs | `console.get_logs()` / `console.event_log()` | Y | +| GET /v1/console/pass-template-pairs | `console.list_pass_template_pairs()` | Y | +| POST /v1/console/card-templates/{id}/ios_preflight | `console.ios_preflight()` | - | +| GET /v1/console/ledger-items | `console.list_ledger_items()` | Y | +| GET /v1/console/webhooks | `console.webhooks.list()` | - | +| POST /v1/console/webhooks | `console.webhooks.create()` | - | +| DELETE /v1/console/webhooks/{id} | `console.webhooks.delete()` | - | +| POST /v1/console/hid/orgs | `console.hid.orgs.create()` | - | +| POST /v1/console/hid/orgs/activate | `console.hid.orgs.activate()` | - | +| GET /v1/console/hid/orgs | `console.hid.orgs.list()` | - | + ## License The gem is available as open source under the terms of the MIT License. From 093cd7dff390ef425bda7f8bee793447119ec1af Mon Sep 17 00:00:00 2001 From: Auston Bunsen Date: Wed, 25 Mar 2026 23:36:41 -0700 Subject: [PATCH 3/5] Fix ting wit de rubeee gem --- .github/workflows/ci.yml | 2 +- README.md | 2 +- accessgrid.gemspec | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d938f0..b0cc0d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,7 +67,7 @@ jobs: strategy: matrix: - ruby: ['4.0', '3.4', '2.7', '2.6'] + ruby: ['4.0', '3.4', '2.7', '2.19'] steps: - name: Checkout code diff --git a/README.md b/README.md index 50da2a1..5d5ee0d 100644 --- a/README.md +++ b/README.md @@ -276,7 +276,7 @@ end ## Requirements -- Ruby 2.6 or higher +- Ruby 2.19 or higher ## Security diff --git a/accessgrid.gemspec b/accessgrid.gemspec index 3ce5a92..7051114 100644 --- a/accessgrid.gemspec +++ b/accessgrid.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |spec| spec.description = 'A Ruby client for the AccessGrid API' spec.homepage = 'https://github.com/access-grid/accessgrid-rb' spec.license = 'MIT' - spec.required_ruby_version = '>= 2.6.0' + spec.required_ruby_version = '>= 2.19.2' spec.metadata = { 'source_code_uri' => 'https://github.com/access-grid/accessgrid-rb' } From d1d36dbe070a32f33254ee60dbf7f84a493e1c67 Mon Sep 17 00:00:00 2001 From: Auston Bunsen Date: Wed, 25 Mar 2026 23:44:29 -0700 Subject: [PATCH 4/5] Fix ting wit de rubeee gem.lock --- Gemfile.lock | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index cad1cd4..e65e3d7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,53 +7,57 @@ PATH GEM remote: https://rubygems.org/ specs: - addressable (2.8.7) - public_suffix (>= 2.0.2, < 7.0) + addressable (2.8.9) + public_suffix (>= 2.0.2, < 8.0) ast (2.4.3) base64 (0.3.0) - bigdecimal (3.1.9) + bigdecimal (4.0.1) bundler-audit (0.9.3) bundler (>= 1.2.0) thor (~> 1.0) coderay (1.1.3) - crack (1.0.0) + crack (1.0.1) bigdecimal rexml - diff-lcs (1.5.1) + diff-lcs (1.6.2) docile (1.4.1) - hashdiff (1.1.2) - json (2.18.0) + hashdiff (1.2.1) + io-console (0.8.2) + json (2.19.3) language_server-protocol (3.17.0.5) lint_roller (1.1.0) method_source (1.1.0) parallel (1.27.0) - parser (3.3.10.1) + parser (3.3.10.2) ast (~> 2.4.1) racc prism (1.9.0) - pry (0.15.2) + pry (0.16.0) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (6.0.1) + reline (>= 0.6.0) + public_suffix (7.0.5) racc (1.8.1) rainbow (3.1.1) - rake (13.2.1) + rake (13.3.1) regexp_parser (2.11.3) + reline (0.6.3) + io-console (~> 0.5) rexml (3.4.4) - rspec (3.13.0) + rspec (3.13.2) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.2) + rspec-core (3.13.6) rspec-support (~> 3.13.0) - rspec-expectations (3.13.3) + rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.2) + rspec-mocks (3.13.8) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-support (3.13.2) - rubocop (1.84.0) + rspec-support (3.13.7) + rubocop (1.86.0) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -64,7 +68,7 @@ GEM rubocop-ast (>= 1.49.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.49.0) + rubocop-ast (1.49.1) parser (>= 3.3.7.2) prism (~> 1.7) ruby-progressbar (1.13.0) @@ -78,7 +82,7 @@ GEM unicode-display_width (3.2.0) unicode-emoji (~> 4.1) unicode-emoji (4.2.0) - webmock (3.24.0) + webmock (3.26.2) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) From 5a90dd22e3b4a543634f74c69b284c3d85e2acd4 Mon Sep 17 00:00:00 2001 From: Auston Bunsen Date: Wed, 25 Mar 2026 23:47:55 -0700 Subject: [PATCH 5/5] Fix ting wit de rubeee .gemspec --- accessgrid.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accessgrid.gemspec b/accessgrid.gemspec index 7051114..aa24ebc 100644 --- a/accessgrid.gemspec +++ b/accessgrid.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |spec| spec.description = 'A Ruby client for the AccessGrid API' spec.homepage = 'https://github.com/access-grid/accessgrid-rb' spec.license = 'MIT' - spec.required_ruby_version = '>= 2.19.2' + spec.required_ruby_version = '>= 3.0' spec.metadata = { 'source_code_uri' => 'https://github.com/access-grid/accessgrid-rb' }