Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
version bump to 0.5.0 -- helpers for zabbix attributes, added MediaTy…
…pe, Medium, User, UserGroup, Action, Operation, Condition
- Loading branch information
Dhruv Bansal
committed
Feb 17, 2012
1 parent
aaacec0
commit 6061da0
Showing
34 changed files
with
1,438 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.4.4 | ||
0.5.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module Rubix | ||
module Associations | ||
|
||
module BelongsToAction | ||
|
||
def action= a | ||
return unless a | ||
@action = a | ||
@action_id = a.id | ||
end | ||
|
||
def action | ||
@action | ||
end | ||
|
||
def action_id= aid | ||
return unless aid | ||
@action_id = aid | ||
end | ||
|
||
def action_id | ||
return @action_id if @action_id | ||
return unless @action | ||
@action_id = @action.id | ||
end | ||
|
||
end | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module Rubix | ||
module Associations | ||
|
||
module BelongsToMediaType | ||
|
||
def media_type= mt | ||
return unless mt | ||
@media_type = mt | ||
@media_type_id = mt.id | ||
end | ||
|
||
def media_type | ||
return @media_type if @media_type | ||
return unless @media_type_id | ||
@media_type = MediaType.find(:id => @media_type_id) | ||
end | ||
|
||
def media_type_id= mtid | ||
return unless mtid | ||
@media_type_id = mtid | ||
end | ||
|
||
def media_type_id | ||
return @media_type_id if @media_type_id | ||
return unless @media_type | ||
@media_type_id = @media_type.id | ||
end | ||
|
||
end | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module Rubix | ||
module Associations | ||
|
||
module BelongsToUser | ||
|
||
def user= u | ||
return unless u | ||
@user = u | ||
@user_id = u.id | ||
end | ||
|
||
def user | ||
return @user if @user | ||
return unless @user_id | ||
@user = User.find(:id => @user_id) | ||
end | ||
|
||
def user_id= uid | ||
return unless uid | ||
@user_id = uid | ||
end | ||
|
||
def user_id | ||
return @user_id if @user_id | ||
return unless @user | ||
@user_id = @user.id | ||
end | ||
|
||
end | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module Rubix | ||
module Associations | ||
module BelongsToUserGroup | ||
|
||
def user_group= ug | ||
return unless ug | ||
@user_group = ug | ||
@user_group_id = ug.id | ||
end | ||
|
||
def user_group | ||
return @user_group if @user_group | ||
return unless @user_group_id | ||
@user_group = UserGroup.find(:id => @user_group_id) | ||
end | ||
|
||
def user_group_id= ugid | ||
return unless ugid | ||
@user_group_id = ugid | ||
end | ||
|
||
def user_group_id | ||
return @user_group_id if @user_group_id | ||
return unless @user_group | ||
@user_group_id = @user_group.id | ||
end | ||
|
||
end | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module Rubix | ||
module Associations | ||
module HasManyConditions | ||
|
||
def self.included klass | ||
klass.send(:zabbix_attr, :condition_operator, :default => :and_or, :required => true) | ||
end | ||
|
||
def conditions | ||
@conditions ||= [] | ||
end | ||
|
||
def conditions= cs | ||
@conditions = cs.map do |c| | ||
c.kind_of?(Condition) ? c : Condition.new(c) | ||
end | ||
end | ||
|
||
end | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module Rubix | ||
module Associations | ||
module HasManyUserGroups | ||
|
||
def user_groups= ugs | ||
return unless ugs | ||
@user_groups = ugs | ||
@user_group_ids = ugs.map(&:id) | ||
end | ||
|
||
def user_groups | ||
return @user_groups if @user_groups | ||
return unless @user_group_ids | ||
@user_groups = @user_group_ids.map { |ugid| UserGroup.find(:id => ugid) } | ||
end | ||
|
||
def user_group_ids= ugids | ||
return unless ugids | ||
@user_group_ids = ugids | ||
end | ||
|
||
def user_group_ids | ||
return @user_group_ids if @user_group_ids | ||
return unless @user_groups | ||
@user_group_ids = @user_groups.map(&:id) | ||
end | ||
|
||
end | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module Rubix | ||
module Associations | ||
module HasManyUsers | ||
|
||
def users= us | ||
return unless us | ||
@users = us | ||
@user_ids = us.map(&:id) | ||
end | ||
|
||
def users | ||
return @users if @users | ||
return unless @user_ids | ||
@users = @user_ids.map { |uid| User.find(:id => uid) } | ||
end | ||
|
||
def user_ids= uids | ||
return unless uids | ||
@user_ids = uids | ||
end | ||
|
||
def user_ids | ||
return @user_ids if @user_ids | ||
return unless @users | ||
@user_ids = @users.map(&:id) | ||
end | ||
|
||
end | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
module Rubix | ||
autoload :Model, 'rubix/models/model' | ||
autoload :HostGroup, 'rubix/models/host_group' | ||
autoload :Template, 'rubix/models/template' | ||
autoload :Host, 'rubix/models/host' | ||
autoload :Item, 'rubix/models/item' | ||
autoload :Application, 'rubix/models/application' | ||
autoload :UserMacro, 'rubix/models/user_macro' | ||
autoload :Trigger, 'rubix/models/trigger' | ||
autoload :TimeSeries, 'rubix/models/time_series' | ||
autoload :MediaType, 'rubix/models/media_type' | ||
autoload :Script, 'rubix/models/script' | ||
autoload :Model, 'rubix/models/model' | ||
autoload :HostGroup, 'rubix/models/host_group' | ||
autoload :Template, 'rubix/models/template' | ||
autoload :Host, 'rubix/models/host' | ||
autoload :Item, 'rubix/models/item' | ||
autoload :Application, 'rubix/models/application' | ||
autoload :UserMacro, 'rubix/models/user_macro' | ||
autoload :Trigger, 'rubix/models/trigger' | ||
autoload :TimeSeries, 'rubix/models/time_series' | ||
autoload :MediaType, 'rubix/models/media_type' | ||
autoload :Script, 'rubix/models/script' | ||
autoload :Action, 'rubix/models/action' | ||
autoload :Condition, 'rubix/models/condition' | ||
autoload :Operation, 'rubix/models/operation' | ||
autoload :User, 'rubix/models/user' | ||
autoload :UserGroup, 'rubix/models/user_group' | ||
autoload :Medium, 'rubix/models/medium' | ||
end |
Oops, something went wrong.