class Flapjack::Data::Tag
Public Class Methods
jsonapi_associations()
click to toggle source
# File lib/flapjack/data/tag.rb, line 205 def self.jsonapi_associations unless instance_variable_defined?('@jsonapi_associations') @jsonapi_associations = { :checks => Flapjack::Gateways::JSONAPI::Data::JoinDescriptor.new( :post => true, :get => true, :patch => true, :delete => true, :number => :multiple, :link => true, :includable => true, :descriptions => { :post => "Associate checks with this tag.", :get => "Returns all checks linked to this tag.", :patch => "Update the checks associated with this tag.", :delete => "Delete associations between checks and this tag." } ), :contacts => Flapjack::Gateways::JSONAPI::Data::JoinDescriptor.new( :post => true, :get => true, :patch => true, :delete => true, :number => :multiple, :link => true, :includable => true, :descriptions => { :post => "Associate contacts with this tag.", :get => "Returns all contacts linked to this tag.", :patch => "Update the contacts associated with this tag.", :delete => "Delete associations between contacts and this tag." } ), :rules => Flapjack::Gateways::JSONAPI::Data::JoinDescriptor.new( :post => true, :get => true, :patch => true, :delete => true, :number => :multiple, :link => true, :includable => true, :descriptions => { :post => "Associate rules with this tag.", :get => "Returns all rules linked to this tag.", :patch => "Update the rules associated with this tag.", :delete => "Delete associations between rules and this tag." } ), :scheduled_maintenances => Flapjack::Gateways::JSONAPI::Data::JoinDescriptor.new( :get => true, :number => :multiple, :link => true, :includable => false, :type => 'scheduled_maintenance', :klass => Flapjack::Data::ScheduledMaintenance, :descriptions => { :get => "Returns all scheduled maintenance periods for " \ "checks linked to this tag; default sort order is " \ "newest first." } ), :states => Flapjack::Gateways::JSONAPI::Data::JoinDescriptor.new( :get => true, :number => :multiple, :link => true, :includable => false, :type => 'state', :klass => Flapjack::Data::State, :descriptions => { :get => "Returns all state records for all checks linked to " \ "this tag; default sort order is newest first." } ), :unscheduled_maintenances => Flapjack::Gateways::JSONAPI::Data::JoinDescriptor.new( :get => true, :number => :multiple, :link => true, :includable => false, :type => 'unscheduled_maintenance', :klass => Flapjack::Data::UnscheduledMaintenance, :descriptions => { :get => "Returns all unscheduled maintenance periods for " \ "checks linked to this tag; default sort order is " \ "newest first." } ) } populate_association_data(@jsonapi_associations) end @jsonapi_associations end
jsonapi_methods()
click to toggle source
# File lib/flapjack/data/tag.rb, line 173 def self.jsonapi_methods @jsonapi_methods ||= { :post => Flapjack::Gateways::JSONAPI::Data::MethodDescriptor.new( :attributes => [:name], :descriptions => { :singular => "Create a tag.", :multiple => "Create tags." } ), :get => Flapjack::Gateways::JSONAPI::Data::MethodDescriptor.new( :attributes => [:name], :descriptions => { :singular => "Returns data for a tag.", :multiple => "Returns data for tags." } ), :patch => Flapjack::Gateways::JSONAPI::Data::MethodDescriptor.new( :attributes => [:name], :descriptions => { :singular => "Update a tag.", :multiple => "Update tags." } ), :delete => Flapjack::Gateways::JSONAPI::Data::MethodDescriptor.new( :descriptions => { :singular => "Delete a tag.", :multiple => "Delete tags." } ) } end
swagger_included_classes()
click to toggle source
# File lib/flapjack/data/tag.rb, line 159 def self.swagger_included_classes # hack -- hardcoding for now [ Flapjack::Data::Check, Flapjack::Data::Contact, Flapjack::Data::Medium, Flapjack::Data::Rule, Flapjack::Data::ScheduledMaintenance, Flapjack::Data::State, Flapjack::Data::Tag, Flapjack::Data::UnscheduledMaintenance ] end
Public Instance Methods
scheduled_maintenances()
click to toggle source
# File lib/flapjack/data/tag.rb, line 44 def scheduled_maintenances sm_assocs = self.checks.associations_for(:scheduled_maintenances). values Flapjack::Data::ScheduledMaintenance.intersect(:id => sm_assocs) end
states()
click to toggle source
# File lib/flapjack/data/tag.rb, line 51 def states st_assocs = self.checks.associations_for(:states). values Flapjack::Data::State.intersect(:id => st_assocs) end
unscheduled_maintenances()
click to toggle source
# File lib/flapjack/data/tag.rb, line 58 def unscheduled_maintenances usm_assocs = self.checks.associations_for(:unscheduled_maintenances). values Flapjack::Data::UnscheduledMaintenance.intersect(:id => usm_assocs) end