Skip to content

Commit

Permalink
Adicionado método para listar itens associados a uma assinatura. (#12)
Browse files Browse the repository at this point in the history
* Adicionado método para listar itens associados a uma assinatura.
  • Loading branch information
rainerborene authored and laerte-guimaraes committed Apr 26, 2019
1 parent 9fd8c5a commit 6c20ec3
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 1 deletion.
10 changes: 10 additions & 0 deletions lib/vindi/rest/subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ def reactivate_subscription(subscription_id, options = {})
def delete_subscription(subscription_id, options = {})
delete("subscriptions/#{subscription_id}", options)[:subscription]
end

# List product items for a subscription
#
# @params subscription_id
# @see https://vindi.github.io/api-docs/dist/#!/subscriptions/GET_version_subscriptions_id_product_items_format
# @example List subscription product items #2
# client.list_subscription_product_items(2)
def list_subscription_product_items(subscription_id, options = {})
get("subscriptions/#{subscription_id}/product_items", options)[:product_items]
end
end
end
end
2 changes: 1 addition & 1 deletion lib/vindi/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Vindi
VERSION = '0.0.4'
VERSION = '0.0.5'
end

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions spec/vindi/rest/subscription_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,14 @@
end
end
end

describe 'list_subscription_product_items' do
it 'returns the associated product items of subscription' do
VCR.use_cassette("rest/subscriptions/list_subscription_product_items") do
product_items = client.list_subscription_product_items(91327)
assert_requested :get, vindi_url("subscriptions/91327/product_items")
expect(product_items).to be_kind_of(Array)
end
end
end
end

0 comments on commit 6c20ec3

Please sign in to comment.