From 266b5337108603e98d251d971f4c232951cf5dee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Wolf?= Date: Thu, 9 Nov 2023 11:50:40 +0100 Subject: [PATCH 1/2] Add possibility to create and remove offering overrides --- lib/tarpon/entity/subscriber.rb | 2 +- lib/tarpon/request/subscriber/offering.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/tarpon/entity/subscriber.rb b/lib/tarpon/entity/subscriber.rb index 525b0b0..99e8d7c 100644 --- a/lib/tarpon/entity/subscriber.rb +++ b/lib/tarpon/entity/subscriber.rb @@ -7,7 +7,7 @@ class Subscriber def initialize(attributes = {}) @raw = attributes - @entitlements = EntitlementList.new(attributes[:entitlements]) + @entitlements = EntitlementList.new(attributes[:entitlements] || {}) end end end diff --git a/lib/tarpon/request/subscriber/offering.rb b/lib/tarpon/request/subscriber/offering.rb index 775a4a4..38ea2dd 100644 --- a/lib/tarpon/request/subscriber/offering.rb +++ b/lib/tarpon/request/subscriber/offering.rb @@ -11,6 +11,14 @@ def initialize(subscriber_path:, **opts) @subscriber_path = subscriber_path end + def create_override(offering_id) + perform(method: :post, path: "#{path}/#{offering_id}/override", key: :secret) + end + + def remove_override + perform(method: :delete, path: "#{path}/override", key: :secret) + end + def list(platform) response = perform(method: :get, path: path.to_s, headers: { 'x-platform': platform.to_s }, key: :public) return response unless response.success? From eb3261badf6706f411fdb55db396aec5476414a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Wolf?= Date: Thu, 9 Nov 2023 12:00:07 +0100 Subject: [PATCH 2/2] Move development gem dependencies to Gemfile (according to Rubocop) --- Gemfile | 6 ++++++ tarpon.gemspec | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 7f4f5e9..b707289 100644 --- a/Gemfile +++ b/Gemfile @@ -3,3 +3,9 @@ source 'https://rubygems.org' gemspec + +gem 'factory_bot', '~> 6.2' +gem 'rake', '~> 13.0' +gem 'rspec', '~> 3.11' +gem 'rubocop', '~> 1.29' +gem 'webmock', '~> 3.14' diff --git a/tarpon.gemspec b/tarpon.gemspec index 423167a..5698af4 100644 --- a/tarpon.gemspec +++ b/tarpon.gemspec @@ -28,10 +28,4 @@ Gem::Specification.new do |spec| spec.required_ruby_version = '>= 2.7' spec.add_dependency 'http', '~> 4.4' - - spec.add_development_dependency 'factory_bot', '~> 6.2' - spec.add_development_dependency 'rake', '~> 13.0' - spec.add_development_dependency 'rspec', '~> 3.11' - spec.add_development_dependency 'rubocop', '~> 1.29' - spec.add_development_dependency 'webmock', '~> 3.14' end