class OnappMarket::OnApp::Search

OnApp specific supply functions

Public Class Methods

new(api) click to toggle source

Create new instance

Attributes

  • api - The api which manages this resource

# File lib/onapp_market/onapp/search.rb, line 14
def initialize(api)
  super(api)
end

Public Instance Methods

find_zone(resource_query = nil, pricing_query = nil, offset = 0, limit = -1) click to toggle source

Find hypervisor zones which match the specified query.

Attributes

# Find zones in London, irrespective of price
search.find_zone(:location_city.eq "London")

Returns

Roles

trader, admin

# File lib/onapp_market/onapp/search.rb, line 31
def find_zone(resource_query = nil, pricing_query = nil, offset = 0, limit = -1)
  resource_query = OnappMarket::API::Query::And.new(:type.eq(OnappMarket::OnApp::HypervisorZone::TYPE), resource_query) unless resource_query == nil
  resource_query = OnappMarket::API::Query::And.new(:type.eq(OnappMarket::OnApp::HypervisorZone::TYPE)) if resource_query == nil
  pricing_query = OnappMarket::API::Query::And.new(:type.eq(OnappMarket::OnApp::HypervisorZonePricing::TYPE), pricing_query) unless pricing_query == nil
  pricing_query = OnappMarket::API::Query::And.new(:type.eq(OnappMarket::OnApp::HypervisorZonePricing::TYPE)) if pricing_query == nil
  find(resource_query, pricing_query, offset, limit)
end