Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to create and remove offering overrides #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
2 changes: 1 addition & 1 deletion lib/tarpon/entity/subscriber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Subscriber

def initialize(attributes = {})
@raw = attributes
@entitlements = EntitlementList.new(attributes[:entitlements])
@entitlements = EntitlementList.new(attributes[:entitlements] || {})
igorbelo marked this conversation as resolved.
Show resolved Hide resolved
end
end
end
Expand Down
8 changes: 8 additions & 0 deletions lib/tarpon/request/subscriber/offering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
6 changes: 0 additions & 6 deletions tarpon.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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