Skip to content

Commit

Permalink
Exposing regions as a primary collection /api/regions
Browse files Browse the repository at this point in the history
- /api/regions
- Enhanced miq_product_features to support Region queries/edits
- Support queries of /api/regions
- Support "query" post for bulk queries
  • Loading branch information
abellotti committed Mar 6, 2017
1 parent 17cdff5 commit 65f703f
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/controllers/api/regions_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Api
class RegionsController < BaseController
end
end
18 changes: 18 additions & 0 deletions config/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,24 @@
:delete:
- :name: delete
:identifier: chargeback_rates_delete
:regions:
:description: Regions
:identifier: region
:options:
- :collection
:verbs: *gp
:klass: MiqRegion
:collection_actions:
:get:
- :name: read
:identifier: region
:post:
- :name: query
:identifier: region
:resource_actions:
:get:
- :name: read
:identifier: region
:reports:
:description: Reports
:identifier: miq_report
Expand Down
17 changes: 17 additions & 0 deletions db/fixtures/miq_product_features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2716,6 +2716,23 @@
:feature_type: admin
:hidden: true
:identifier: zone_delete
- :name: Regions
:description: Regions
:feature_type: node
:hidden: true
:identifier: region
:children:
- :name: Modify
:description: Modify Regions
:feature_type: admin
:identifier: region_admin
:hidden: true
:children:
- :name: Edit
:description: Edit a Region
:feature_type: admin
:hidden: true
:identifier: region_edit
- :name: Access Control
:description: Access Control Accordion
:feature_type: node
Expand Down
10 changes: 10 additions & 0 deletions spec/requests/api/collections_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ def test_collection_bulk_query(collection, collection_url, klass, id = nil)
test_collection_query(:rates, rates_url, ChargebackRateDetail)
end

it "query Regions" do
FactoryGirl.create(:miq_region)
test_collection_query(:regions, regions_url, MiqRegion)
end

it "query Reports" do
FactoryGirl.create(:miq_report)
test_collection_query(:reports, reports_url, MiqReport)
Expand Down Expand Up @@ -433,6 +438,11 @@ def test_collection_bulk_query(collection, collection_url, klass, id = nil)
test_collection_bulk_query(:rates, rates_url, ChargebackRateDetail)
end

it "bulk query Regions" do
FactoryGirl.create(:miq_region)
test_collection_bulk_query(:regions, regions_url, MiqRegion)
end

it "bulk query Report Results" do
FactoryGirl.create(:miq_report_result)
test_collection_bulk_query(:results, results_url, MiqReportResult)
Expand Down

0 comments on commit 65f703f

Please sign in to comment.