repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/kernel/singleton_class.rb | motion/core_ext/kernel/singleton_class.rb | module Kernel
# class_eval on an object acts like singleton_class.class_eval.
def class_eval(*args, &block)
singleton_class.class_eval(*args, &block)
end
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/range/include_range.rb | motion/core_ext/range/include_range.rb | class Range
# Extends the default Range#include? to support range comparisons.
# (1..5).include?(1..5) # => true
# (1..5).include?(2..3) # => true
# (1..5).include?(2..6) # => false
#
# The native Range#include? behavior is untouched.
# ('a'..'f').include?('c') # => true
# (5..9).include?(11) # => ... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/range/overlaps.rb | motion/core_ext/range/overlaps.rb | class Range
# Compare two ranges and see if they overlap each other
# (1..5).overlaps?(4..6) # => true
# (1..5).overlaps?(7..9) # => false
def overlaps?(other)
cover?(other.first) || other.cover?(first)
end
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/time/conversions.rb | motion/core_ext/time/conversions.rb | class Time
DATE_FORMATS = {
:db => '%Y-%m-%d %H:%M:%S',
:number => '%Y%m%d%H%M%S',
:nsec => '%Y%m%d%H%M%S%9N',
:time => '%H:%M',
:short => '%d %b %H:%M',
:long => '%B %d, %Y %H:%M',
:long_ordinal => lambda { |time|
day_format = MotionSup... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/time/acts_like.rb | motion/core_ext/time/acts_like.rb | class Time
# Duck-types as a Time-like class. See Object#acts_like?.
def acts_like_time?
true
end
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/time/calculations.rb | motion/core_ext/time/calculations.rb | class Time
include DateAndTime::Calculations
COMMON_YEAR_DAYS_IN_MONTH = [nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
class << self
# Return the number of days in the given month.
# If no year is specified, it will use the current year.
def days_in_month(month, year = now.year)
if mon... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/object/to_json.rb | motion/core_ext/object/to_json.rb | # encoding: utf-8
class Object
# Serializes the object to a hash then the hash using Cocoa's NSJSONSerialization
def to_json
attributes =
if respond_to?(:to_hash)
to_hash.as_json
else
instance_values.as_json
end
attributes.to_json
end
end
class NilClass
# Returns 'nu... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/object/instance_variables.rb | motion/core_ext/object/instance_variables.rb | class Object
# Returns a hash with string keys that maps instance variable names without "@" to their
# corresponding values.
#
# class C
# def initialize(x, y)
# @x, @y = x, y
# end
# end
#
# C.new(0, 1).instance_values # => {"x" => 0, "y" => 1}
def instance_values
Hash[in... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/object/duplicable.rb | motion/core_ext/object/duplicable.rb | #--
# Most objects are cloneable, but not all. For example you can't dup +nil+:
#
# nil.dup # => TypeError: can't dup NilClass
#
# Classes may signal their instances are not duplicable removing +dup+/+clone+
# or raising exceptions from them. So, to dup an arbitrary object you normally
# use an optimistic approach an... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/object/to_param.rb | motion/core_ext/object/to_param.rb | class Object
# Alias of <tt>to_s</tt>.
def to_param
to_s
end
end
class NilClass
# Returns +self+.
def to_param
self
end
end
class TrueClass
# Returns +self+.
def to_param
self
end
end
class FalseClass
# Returns +self+.
def to_param
self
end
end
class Array
# Calls <tt>to_pa... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/object/blank.rb | motion/core_ext/object/blank.rb | # encoding: utf-8
class Object
# An object is blank if it's false, empty, or a whitespace string.
# For example, '', ' ', +nil+, [], and {} are all blank.
#
# This simplifies:
#
# if address.nil? || address.empty?
#
# ...to:
#
# if address.blank?
def blank?
respond_to?(:empty?) ? empty?... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/object/deep_dup.rb | motion/core_ext/object/deep_dup.rb | class Object
# Returns a deep copy of object if it's duplicable. If it's
# not duplicable, returns +self+.
#
# object = Object.new
# dup = object.deep_dup
# dup.instance_variable_set(:@a, 1)
#
# object.instance_variable_defined?(:@a) #=> false
# dup.instance_variable_defined?(:@a) #=> ... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/object/to_query.rb | motion/core_ext/object/to_query.rb | class Object
# Converts an object into a string suitable for use as a URL query string, using the given <tt>key</tt> as the
# param name.
#
# Note: This method is defined as a default implementation for all Objects for Hash#to_query to work.
def to_query(key)
"#{CGI.escape(key.to_param)}=#{CGI.escape(to_p... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/object/try.rb | motion/core_ext/object/try.rb | class Object
# Invokes the public method whose name goes as first argument just like
# +public_send+ does, except that if the receiver does not respond to it the
# call returns +nil+ rather than raising an exception.
#
# This method is defined to be able to write
#
# @person.try(:name)
#
# instead o... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/object/acts_like.rb | motion/core_ext/object/acts_like.rb | class Object
# A duck-type assistant method. For example, Active Support extends Date
# to define an <tt>acts_like_date?</tt> method, and extends Time to define
# <tt>acts_like_time?</tt>. As a result, we can do <tt>x.acts_like?(:time)</tt> and
# <tt>x.acts_like?(:date)</tt> to do duck-type-safe comparisons, si... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/object/inclusion.rb | motion/core_ext/object/inclusion.rb | class Object
# Returns true if this object is included in the argument(s). Argument must be
# any object which responds to +#include?+. Usage:
#
# characters = ['Konata', 'Kagami', 'Tsukasa']
# 'Konata'.in?(characters) # => true
#
# This will throw an ArgumentError it doesn't respond to +#include?+.
... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/date_and_time/calculations.rb | motion/core_ext/date_and_time/calculations.rb | module DateAndTime
module Calculations
DAYS_INTO_WEEK = {
:monday => 0,
:tuesday => 1,
:wednesday => 2,
:thursday => 3,
:friday => 4,
:saturday => 5,
:sunday => 6
}
# Returns a new date/time representing yesterday.
def yesterday
advance(:da... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/array/conversions.rb | motion/core_ext/array/conversions.rb | class Array
# Converts the array to a comma-separated sentence where the last element is
# joined by the connector word.
#
# You can pass the following options to change the default behavior. If you
# pass an option key that doesn't exist in the list below, it will raise an
# <tt>ArgumentError</tt>.
#
#... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/array/extract_options.rb | motion/core_ext/array/extract_options.rb | class Array
# Extracts options from a set of arguments. Removes and returns the last
# element in the array if it's a hash, otherwise returns a blank hash.
def extract_options!
if last.is_a?(Hash)
pop
else
{}
end
end
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/array/grouping.rb | motion/core_ext/array/grouping.rb | class Array
# Splits or iterates over the array in groups of size +number+,
# padding any remaining slots with +fill_with+ unless it is +false+.
#
# %w(1 2 3 4 5 6 7 8 9 10).in_groups_of(3) {|group| p group}
# ["1", "2", "3"]
# ["4", "5", "6"]
# ["7", "8", "9"]
# ["10", nil, nil]
#
# %w(... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/array/access.rb | motion/core_ext/array/access.rb | class Array
# Returns the tail of the array from +position+.
#
# %w( a b c d ).from(0) # => ["a", "b", "c", "d"]
# %w( a b c d ).from(2) # => ["c", "d"]
# %w( a b c d ).from(10) # => []
# %w().from(0) # => []
def from(position)
self[position, length] || []
end
# Returns the be... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/array/prepend_and_append.rb | motion/core_ext/array/prepend_and_append.rb | class Array
# The human way of thinking about adding stuff to the end of a list is with append
alias_method :append, :<<
# The human way of thinking about adding stuff to the beginning of a list is with prepend
alias_method :prepend, :unshift
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/array/wrap.rb | motion/core_ext/array/wrap.rb | class Array
# Wraps its argument in an array unless it is already an array (or array-like).
#
# Specifically:
#
# * If the argument is +nil+ an empty list is returned.
# * Otherwise, if the argument responds to +to_ary+ it is invoked, and its result returned.
# * Otherwise, returns an array with the argum... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/class/attribute.rb | motion/core_ext/class/attribute.rb | class Class
# Declare a class-level attribute whose value is inheritable by subclasses.
# Subclasses can change their own value and it will not impact parent class.
#
# class Base
# class_attribute :setting
# end
#
# class Subclass < Base
# end
#
# Base.setting = true
# Subclass.... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/class/attribute_accessors.rb | motion/core_ext/class/attribute_accessors.rb | # Extends the class object with class and instance accessors for class attributes,
# just like the native attr* accessors for instance attributes.
class Class
# Defines a class attribute if it's not defined and creates a reader method that
# returns the attribute value.
#
# class Person
# cattr_reader :... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/module/anonymous.rb | motion/core_ext/module/anonymous.rb | class Module
# A module may or may not have a name.
#
# module M; end
# M.name # => "M"
#
# m = Module.new
# m.name # => nil
#
# A module gets a name when it is first assigned to a constant. Either
# via the +module+ or +class+ keyword or by an explicit assignment:
#
# m = Module.new #... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/module/remove_method.rb | motion/core_ext/module/remove_method.rb | class Module
def remove_possible_method(method)
if method_defined?(method) || private_method_defined?(method)
undef_method(method)
end
end
def redefine_method(method, &block)
remove_possible_method(method)
define_method(method, &block)
end
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/module/reachable.rb | motion/core_ext/module/reachable.rb | class Module
def reachable? #:nodoc:
!anonymous? && name.safe_constantize.equal?(self)
end
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/module/attribute_accessors.rb | motion/core_ext/module/attribute_accessors.rb | class Module
def mattr_reader(*syms)
receiver = self
options = syms.extract_options!
syms.each do |sym|
raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\w*$/
class_exec do
unless class_variable_defined?("@@#{sym}")
class_variable_set("@@#{sym}", nil)
... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/module/introspection.rb | motion/core_ext/module/introspection.rb | class Module
# Returns the name of the module containing this one.
#
# M::N.parent_name # => "M"
def parent_name
if defined? @parent_name
@parent_name
else
@parent_name = name =~ /::[^:]+\Z/ ? $`.freeze : nil
end
end
# Returns the module which contains this one according to its na... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/module/delegation.rb | motion/core_ext/module/delegation.rb | class Module
# Provides a delegate class method to easily expose contained objects' public methods
# as your own. Pass one or more methods (specified as symbols or strings)
# and the name of the target object via the <tt>:to</tt> option (also a symbol
# or string). At least one method and the <tt>:to</tt> optio... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/module/aliasing.rb | motion/core_ext/module/aliasing.rb | class Module
# Encapsulates the common pattern of:
#
# alias_method :foo_without_feature, :foo
# alias_method :foo, :foo_with_feature
#
# With this, you simply do:
#
# alias_method_chain :foo, :feature
#
# And both aliases are set up for you.
#
# Query and bang methods (foo?, foo!) keep th... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/module/attr_internal.rb | motion/core_ext/module/attr_internal.rb | class Module
# Declares an attribute reader backed by an internally-named instance variable.
def attr_internal_reader(*attrs)
attrs.each {|attr_name| attr_internal_define(attr_name, :reader)}
end
# Declares an attribute writer backed by an internally-named instance variable.
def attr_internal_writer(*att... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/numeric/time.rb | motion/core_ext/numeric/time.rb | class Numeric
# Enables the use of time calculations and declarations, like 45.minutes + 2.hours + 4.years.
#
# These methods use Time#advance for precise date calculations when using from_now, ago, etc.
# as well as adding or subtracting their results from a Time object. For example:
#
# # equivalent to ... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/numeric/conversions.rb | motion/core_ext/numeric/conversions.rb | class Numeric
# Provides options for converting numbers into formatted strings.
# Right now, options are only provided for phone numbers.
#
# ==== Options
#
# For details on which formats use which options, see MotionSupport::NumberHelper
#
# ==== Examples
#
# Phone Numbers:
# 5551234.to_s(:phon... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/numeric/bytes.rb | motion/core_ext/numeric/bytes.rb | class Numeric
KILOBYTE = 1024
MEGABYTE = KILOBYTE * 1024
GIGABYTE = MEGABYTE * 1024
TERABYTE = GIGABYTE * 1024
PETABYTE = TERABYTE * 1024
EXABYTE = PETABYTE * 1024
# Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes
def bytes
self
end
alias :byte :bytes
de... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/trigger.rb | spec/trigger.rb | require 'spec_helper'
describe 'trigger' do
before :all do
@hostgroup = gen_name 'hostgroup'
@hostgroupid = zbx.hostgroups.create(name: @hostgroup)
@template = gen_name 'template'
@templateid = zbx.templates.create(
host: @template,
groups: [groupid: @hostgroupid]
)
@application =... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/usergroup.rb | spec/usergroup.rb | require 'spec_helper'
describe 'usergroup' do
context 'when not exists' do
it 'should be integer id' do
usergroupid = zbx.usergroups.create(name: gen_name('usergroup'))
expect(usergroupid).to be_kind_of(Integer)
end
end
context 'when exists' do
before do
@usergroup = gen_name 'user... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/httptest.rb | spec/httptest.rb | require 'spec_helper'
describe 'httptest' do
before :all do
@hostgroup = gen_name 'hostgroup'
@hostgroupid = zbx.hostgroups.create(name: @hostgroup)
@template = gen_name 'template'
@templateid = zbx.templates.create(
host: @template,
groups: [groupid: @hostgroupid]
)
end
context ... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/basic_func.rb | spec/basic_func.rb | require 'spec_helper'
describe ZabbixApi::Basic do
end
| ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/script.rb | spec/script.rb | require 'spec_helper'
describe 'script' do
before :all do
@hostid = zbx.hosts.get_id(host: 'Zabbix server')
end
context 'when name not exists' do
before do
@script = gen_name 'script'
end
describe 'create' do
it 'should return integer id' do
scriptid = zbx.scripts.create(
... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/maintenance.rb | spec/maintenance.rb | require 'spec_helper'
describe 'maintenance' do
context 'when not exists' do
before :all do
@hostgroupid = zbx.hostgroups.create(name: "hostgroup_#{rand(1_000_000)}")
end
describe 'create' do
it 'should return integer id after creation' do
maintenanceid = zbx.maintenance.create(
... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/event.rb | spec/event.rb | require 'spec_helper'
describe 'event' do
before do
@eventname = gen_name 'event'
@usergroupid = zbx.usergroups.create(name: gen_name('usergroup'))
@eventdata = {
name: @eventname,
eventsource: '0', # event source is a triggerid
status: '0', # event is enabled
esc_period: '120', #... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/application.rb | spec/application.rb | require 'spec_helper'
describe 'application' do
before :all do
@hostgroup = gen_name 'hostgroup'
@hostgroupid = zbx.hostgroups.create(name: @hostgroup)
@template = gen_name 'template'
@templateid = zbx.templates.create(
host: @template,
groups: [groupid: @hostgroupid]
)
end
conte... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/graph.rb | spec/graph.rb | require 'spec_helper'
describe 'graph' do
before :all do
@hostgroup = gen_name 'hostgroup'
@hostgroupid = zbx.hostgroups.create(name: @hostgroup)
@template = gen_name 'template'
@templateid = zbx.templates.create(
host: @template,
groups: [groupid: @hostgroupid]
)
@application = g... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/item.rb | spec/item.rb | require 'spec_helper'
describe 'item' do
before :all do
@hostgroup = gen_name 'hostgroup'
@hostgroupid = zbx.hostgroups.create(name: @hostgroup)
@template = gen_name 'template'
@templateid = zbx.templates.create(
host: @template,
groups: [groupid: @hostgroupid]
)
@application = ge... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/host.rb | spec/host.rb | require 'spec_helper'
describe 'host' do
before :all do
@hostgroup = gen_name 'hostgroup'
@hostgroupid = zbx.hostgroups.create(name: @hostgroup)
end
context 'when name not exists' do
before do
@host = gen_name 'host'
end
describe 'create' do
it 'should return integer id' do
... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/query.rb | spec/query.rb | require 'spec_helper'
describe 'query' do
it 'should works' do
expect(
zbx.query(
method: 'host.get',
params: {
filter: {
host: 'asdf'
},
selectInterfaces: 'refer'
}
)
).to be_kind_of(Array)
end
end
| ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/usermacro.rb | spec/usermacro.rb | require 'spec_helper'
describe 'usermacro' do
before :all do
@hostgroup = gen_name 'hostgroup'
@hostgroupid = zbx.hostgroups.create(name: @hostgroup)
@template = gen_name 'template'
@templateid = zbx.templates.create(
host: @template,
groups: [groupid: @hostgroupid]
)
end
context... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/problem.rb | spec/problem.rb | require 'spec_helper'
describe 'problem' do
before do
@problemdata = {
eventid: gen_id.to_s,
source: "0",
object: "0",
objectid: gen_id.to_s,
clock: "1611856476",
ns: "183091100",
r_eventid: "0",
r_clock: "0",
r_ns: "0",
correlationid: "0",
userid... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/drule.rb | spec/drule.rb | # encoding: utf-8
require 'spec_helper'
describe 'drule' do
before do
@drulename = gen_name 'drule'
@usergroupid = zbx.usergroups.create(:name => gen_name('usergroup'))
@dcheckdata = [{
:type => '9', # zabbix agent
:uniq => '0', # (default) do not use this check as a uniqueness criteria
... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/configuration.rb | spec/configuration.rb | require 'spec_helper'
describe 'configuration' do
before :all do
@hostgroup = gen_name 'hostgroup'
@hostgroup_id = zbx.hostgroups.create(name: @hostgroup)
@template = gen_name 'template'
@template_id = zbx.templates.create(
host: @template,
groups: [groupid: @hostgroup_id]
)
@s... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/template.rb | spec/template.rb | require 'spec_helper'
describe 'template' do
before :all do
@hostgroup = gen_name 'hostgroup'
@hostgroupid = zbx.hostgroups.create(name: @hostgroup)
end
context 'when name not exists' do
before do
@template = gen_name 'template'
end
describe 'create' do
it 'should return integer... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/hostgroup.rb | spec/hostgroup.rb | require 'spec_helper'
describe 'hostgroup' do
context 'when not exists' do
describe 'create' do
it 'should return integer id after creation' do
hostgroupid = zbx.hostgroups.create(name: "hostgroup_#{rand(1_000_000)}")
expect(hostgroupid).to be_kind_of(Integer)
end
end
end
con... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/valuemap.rb | spec/valuemap.rb | require 'spec_helper'
describe 'valuemap' do
before :all do
@valuemap = gen_name 'valuemap'
end
context 'when not exists' do
describe 'create' do
it 'should return an integer id' do
valuemapid = zbx.valuemaps.create_or_update(
name: @valuemap,
mappings: [
'n... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/server.rb | spec/server.rb | require 'spec_helper'
describe 'server' do
describe 'version' do
it 'should be string' do
expect(zbx.server.version).to be_kind_of(String)
end
it 'should be 2.4.x, 3.2.x, 3.4.x, 4.0.x, 5.0.x, or 5.2.x' do
expect(zbx.server.version).to match(/(2\.4|3\.[024]|4\.0|5\.[02])\.\d+/)
end
end
... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/screen.rb | spec/screen.rb | require 'spec_helper'
describe 'screen' do
before :all do
@hostgroup = gen_name 'hostgroup'
@hostgroupid = zbx.hostgroups.create(name: @hostgroup)
@template = gen_name 'template'
@templateid = zbx.templates.create(
host: @template,
groups: [groupid: @hostgroupid]
)
@application = ... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/mediatype.rb | spec/mediatype.rb | require 'spec_helper'
describe 'mediatype' do
before do
@mediatype = gen_name 'mediatype'
end
context 'when not exists' do
describe 'create' do
it 'should return integer id' do
mediatypeid = zbx.mediatypes.create(
name: @mediatype,
type: 0,
smtp_server: '127.0... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/spec_helper.rb | spec/spec_helper.rb | require 'zabbixapi'
def zbx
# settings
@api_url = ENV['ZABBIX_HOST_URL'] || 'http://localhost:8080/api_jsonrpc.php'
@api_login = ENV['ZABBIX_USERNAME'] || 'Admin'
@api_password = ENV['ZABBIX_PASSWORD'] || 'zabbix'
@zbx ||= ZabbixApi.connect(
url: @api_url,
user: @api_login,
password: @api_passwo... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/action.rb | spec/action.rb | require 'spec_helper'
describe 'action' do
before do
@actionname = gen_name 'action'
@usergroupid = zbx.usergroups.create(name: gen_name('usergroup'))
@actiondata = {
name: @actionname,
eventsource: '0', # event source is a triggerid
status: '0', # action is enabled
esc_period: '1... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/user.rb | spec/user.rb | require 'spec_helper'
describe 'user' do
before :all do
@usergroup = gen_name 'usergroup'
@usergroupid = {
usrgrpid: zbx.usergroups.create(name: @usergroup),
}
@roleid = "1"
puts "USERGROUPID: #{@usergroupid}"
@mediatype = gen_name 'mediatype'
@mediatypeid = zbx.mediatypes.create(
... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/client_spec.rb | spec/zabbixapi/client_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Client' do
let(:client_mock) { ZabbixApi::Client.new(options) }
let(:options) { {} }
let(:auth) { double }
let(:api_version) { '5.2.2' }
describe '.id' do
subject { client_mock.id }
before do
allow_any_instance_of(ZabbixApi::Client).to receive(:api_v... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/basic/basic_func_spec.rb | spec/zabbixapi/basic/basic_func_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Basic' do
let(:basic_mock) { ZabbixApi::Basic.new(client) }
let(:client) { double }
describe '.log' do
subject { basic_mock.log(message) }
let(:message) { 'test-message' }
let(:debug) { true }
let(:client) { instance_double('ZabbixApi::Client', options... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/basic/basic_alias_spec.rb | spec/zabbixapi/basic/basic_alias_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Basic' do
let(:basic_mock) { ZabbixApi::Basic.new(client) }
let(:client) { double('mock_client', options: {}, api_request: {} ) }
let(:data) { {} }
after { subject }
describe '.get' do
subject { basic_mock.get(data) }
before do
allow(basic_mock).to ... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/basic/basic_logic_spec.rb | spec/zabbixapi/basic/basic_logic_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Basic' do
let(:basic_mock) { ZabbixApi::Basic.new(client) }
let(:client) { double }
let(:method_name) { 'test-method' }
let(:default_options) { {} }
let(:data_create) { [data] }
let(:result) { 'test-result' }
let(:method) { "#{method_name}.#{operation_name}" }
... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/basic/basic_init_spec.rb | spec/zabbixapi/basic/basic_init_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Basic' do
let(:basic_mock) { ZabbixApi::Basic.new(client) }
let(:client) { double }
describe '.initialize' do
subject { basic_mock }
it 'sets passed client object as class variable' do
expect(subject.instance_variable_get(:@client)).to eq client
end
... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/mediatypes_spec.rb | spec/zabbixapi/classes/mediatypes_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Mediatypes' do
let(:mediatypes_mock) { ZabbixApi::Mediatypes.new(client) }
let(:client) { double }
describe '.method_name' do
subject { mediatypes_mock.method_name }
it { is_expected.to eq 'mediatype' }
end
describe '.identify' do
subject { mediatypes... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/usermacros_spec.rb | spec/zabbixapi/classes/usermacros_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Usermacros' do
let(:usermacros_mock) { ZabbixApi::Usermacros.new(client) }
let(:client) { double }
describe '.identify' do
subject { usermacros_mock.identify }
it { is_expected.to eq 'macro' }
end
describe '.method_name' do
subject { usermacros_mock.m... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/proxies_spec.rb | spec/zabbixapi/classes/proxies_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Proxies' do
let(:proxies_mock) { ZabbixApi::Proxies.new(client) }
let(:client) { double }
describe '.method_name' do
subject { proxies_mock.method_name }
it { is_expected.to eq 'proxy' }
end
describe '.identify' do
subject { proxies_mock.identify }
... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/items_spec.rb | spec/zabbixapi/classes/items_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Items' do
let(:items_mock) { ZabbixApi::Items.new(client) }
let(:client) { double }
describe '.method_name' do
subject { items_mock.method_name }
it { is_expected.to eq 'item' }
end
describe '.identify' do
subject { items_mock.identify }
it { is_... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/hosts_spec.rb | spec/zabbixapi/classes/hosts_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Hosts' do
let(:hosts_mock) { ZabbixApi::Hosts.new(client) }
let(:client) { double }
describe '.method_name' do
subject { hosts_mock.method_name }
it { is_expected.to eq 'host' }
end
describe '.identify' do
subject { hosts_mock.identify }
it { is_... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/triggers_spec.rb | spec/zabbixapi/classes/triggers_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Triggers' do
let(:triggers_mock) { ZabbixApi::Triggers.new(client) }
let(:client) { double }
describe '.method_name' do
subject { triggers_mock.method_name }
it { is_expected.to eq 'trigger' }
end
describe '.identify' do
subject { triggers_mock.identi... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/graphs_spec.rb | spec/zabbixapi/classes/graphs_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Graphs' do
let(:graphs_mock) { ZabbixApi::Graphs.new(client) }
let(:client) { double }
describe '.method_name' do
subject { graphs_mock.method_name }
it { is_expected.to eq 'graph' }
end
describe '.identify' do
subject { graphs_mock.identify }
it... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/maintenance_spec.rb | spec/zabbixapi/classes/maintenance_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Maintenance' do
let(:maintenance_mock) { ZabbixApi::Maintenance.new(client) }
let(:client) { double }
describe '.method_name' do
subject { maintenance_mock.method_name }
it { is_expected.to eq 'maintenance' }
end
describe '.identify' do
subject { main... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/templates_spec.rb | spec/zabbixapi/classes/templates_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Templates' do
let(:templates_mock) { ZabbixApi::Templates.new(client) }
let(:client) { double }
describe '.method_name' do
subject { templates_mock.method_name }
it { is_expected.to eq 'template' }
end
describe '.identify' do
subject { templates_mock.... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/actions_spec.rb | spec/zabbixapi/classes/actions_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Actions' do
let(:actions_mock) { ZabbixApi::Actions.new(client) }
let(:client) { double }
describe '.method_name' do
subject { actions_mock.method_name }
it { is_expected.to eq 'action' }
end
describe '.identify' do
subject { actions_mock.identify }
... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/screens_spec.rb | spec/zabbixapi/classes/screens_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Screens' do
let(:screens_mock) { ZabbixApi::Screens.new(client) }
let(:client) { double }
describe '.method_name' do
subject { screens_mock.method_name }
it { is_expected.to eq 'screen' }
end
describe '.identify' do
subject { screens_mock.identify }
... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/users_spec.rb | spec/zabbixapi/classes/users_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Users' do
let(:users_mock) { ZabbixApi::Users.new(client) }
let(:client) { double }
describe '.method_name' do
subject { users_mock.method_name }
it { is_expected.to eq 'user' }
end
describe '.identify' do
subject { users_mock.identify }
it { is_... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/httptests_spec.rb | spec/zabbixapi/classes/httptests_spec.rb | require 'spec_helper'
describe 'ZabbixApi::HttpTests' do
let(:httptests_mock) { ZabbixApi::HttpTests.new(client) }
let(:client) { double }
describe '.method_name' do
subject { httptests_mock.method_name }
it { is_expected.to eq 'httptest' }
end
describe '.identify' do
subject { httptests_mock.... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/scripts_spec.rb | spec/zabbixapi/classes/scripts_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Scripts' do
let(:scripts_mock) { ZabbixApi::Scripts.new(client) }
let(:client) { double }
describe '.method_name' do
subject { scripts_mock.method_name }
it { is_expected.to eq 'script' }
end
describe '.identify' do
subject { scripts_mock.identify }
... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/server_spec.rb | spec/zabbixapi/classes/server_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Server' do
let(:server_mock) { ZabbixApi::Server.new(client) }
let(:client) { double('mock_client', api_version: 'testresult') }
let(:result) { 'testresult' }
before do
allow(client).to receive(:api_request).with(
method: 'apiinfo.version',
params: {}... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/valuemap_spec.rb | spec/zabbixapi/classes/valuemap_spec.rb | require 'spec_helper'
describe 'ZabbixApi::ValueMaps' do
let(:valuemaps_mock) { ZabbixApi::ValueMaps.new(client) }
let(:client) { double }
describe '.method_name' do
subject { valuemaps_mock.method_name }
it { is_expected.to eq 'valuemap' }
end
describe '.identify' do
subject { valuemaps_mock.... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/applications_spec.rb | spec/zabbixapi/classes/applications_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Applications' do
let(:actions_mock) { ZabbixApi::Applications.new(client) }
let(:client) { double }
describe '.method_name' do
subject { actions_mock.method_name }
it { is_expected.to eq 'application' }
end
describe '.identify' do
subject { actions_mo... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/problems_spec.rb | spec/zabbixapi/classes/problems_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Problems' do
let(:problems_mock) { ZabbixApi::Problems.new(client) }
let(:client) { double }
describe '.method_name' do
subject { problems_mock.method_name }
it { is_expected.to eq 'problem' }
end
describe '.identify' do
subject { problems_mock.identi... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/usergroups_spec.rb | spec/zabbixapi/classes/usergroups_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Usergroups' do
let(:usergroups_mock) { ZabbixApi::Usergroups.new(client) }
let(:client) { double }
describe '.method_name' do
subject { usergroups_mock.method_name }
it { is_expected.to eq 'usergroup' }
end
describe '.identify' do
subject { usergroups... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/configurations_spec.rb | spec/zabbixapi/classes/configurations_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Configurations' do
let(:configurations_mock) { ZabbixApi::Configurations.new(client) }
let(:client) { double }
describe '.array_flag' do
subject { configurations_mock.array_flag }
it { is_expected.to be_truthy }
end
describe '.method_name' do
subject ... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/roles_spec.rb | spec/zabbixapi/classes/roles_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Roles' do
let(:roles_mock) { ZabbixApi::Roles.new(client) }
let(:client) { double }
describe '.method_name' do
subject { roles_mock.method_name }
it { is_expected.to eq 'role' }
end
describe '.identify' do
subject { roles_mock.identify }
it { is_... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/errors_spec.rb | spec/zabbixapi/classes/errors_spec.rb | require 'spec_helper'
describe 'ZabbixApi::BaseError' do
let(:error_mock) { ZabbixApi::BaseError.new(message, response) }
let(:message) { 'Test Message' }
let(:response) { { 'error' => { 'data' => error_data, 'message' => error_message } } }
let(:error_data) { 'Program is borked' }
let(:error_message) { 'som... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/hostgroups_spec.rb | spec/zabbixapi/classes/hostgroups_spec.rb | require 'spec_helper'
describe 'ZabbixApi::HostGroups' do
let(:actions_mock) { ZabbixApi::HostGroups.new(client) }
let(:client) { double }
describe '.method_name' do
subject { actions_mock.method_name }
it { is_expected.to eq 'hostgroup' }
end
describe '.identify' do
subject { actions_mock.ide... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/spec/zabbixapi/classes/unusable_spec.rb | spec/zabbixapi/classes/unusable_spec.rb | require 'spec_helper'
describe 'ZabbixApi::Triggers' do
let(:unusable_mock) { ZabbixApi::Triggers.new(client) }
let(:client) { double }
describe '.create_or_update' do
subject { unusable_mock.create_or_update(data) }
let(:data) { { description: 'testdesc', hostid: 'hostid' } }
before do
all... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/lib/zabbixapi.rb | lib/zabbixapi.rb | require 'zabbixapi/version'
require 'zabbixapi/client'
require 'zabbixapi/basic/basic_alias'
require 'zabbixapi/basic/basic_func'
require 'zabbixapi/basic/basic_init'
require 'zabbixapi/basic/basic_logic'
require 'zabbixapi/classes/actions'
require 'zabbixapi/classes/applications'
require 'zabbixapi/classes/configura... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/lib/zabbixapi/version.rb | lib/zabbixapi/version.rb | class ZabbixApi
VERSION = '6.0.0-alpha4'.freeze
end
| ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/lib/zabbixapi/client.rb | lib/zabbixapi/client.rb | require 'net/http'
require 'json'
require 'openssl'
class ZabbixApi
class Client
# @param (see ZabbixApi::Client#initialize)
# @return [Hash]
attr_reader :options
# @return [Integer]
def id
rand(100_000)
end
# Returns the API version from the Zabbix Server
#
# @return [Str... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/lib/zabbixapi/basic/basic_func.rb | lib/zabbixapi/basic/basic_func.rb | class ZabbixApi
class Basic
# Log messages to stdout when debugging
#
# @param message [String]
def log(message)
puts message.to_s if @client.options[:debug]
end
# Compare two hashes for equality
#
# @param first_hash [Hash]
# @param second_hash [Hash]
# @return [Boolean... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/lib/zabbixapi/basic/basic_logic.rb | lib/zabbixapi/basic/basic_logic.rb | class ZabbixApi
class Basic
# Create new Zabbix object using API (with defaults)
#
# @param data [Hash]
# @raise [ApiError] Error returned when there is a problem with the Zabbix API call.
# @raise [HttpError] Error raised when HTTP status from Zabbix Server response is not a 200 OK.
# @return... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/lib/zabbixapi/basic/basic_init.rb | lib/zabbixapi/basic/basic_init.rb | class ZabbixApi
class Basic
# Initializes a new Basic object with ZabbixApi Client
#
# @param client [ZabbixApi::Client]
# @return [ZabbixApi::Client]
def initialize(client)
@client = client
end
# Placeholder for inherited objects to provide object-specific method name
#
# @... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/lib/zabbixapi/basic/basic_alias.rb | lib/zabbixapi/basic/basic_alias.rb | class ZabbixApi
class Basic
# Get Zabbix object data from API by id
#
# @param data [Hash] Should include object's id field name (identify) and id value
# @raise [ApiError] Error returned when there is a problem with the Zabbix API call.
# @raise [HttpError] Error raised when HTTP status from Zabb... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/lib/zabbixapi/classes/events.rb | lib/zabbixapi/classes/events.rb | class ZabbixApi
class Events < Basic
# The method name used for interacting with Events via Zabbix API
#
# @return [String]
def method_name
'event'
end
# The id field name used for identifying specific Event objects via Zabbix API
#
# @return [String]
def identify
'nam... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/lib/zabbixapi/classes/users.rb | lib/zabbixapi/classes/users.rb | class ZabbixApi
class Users < Basic
# The method name used for interacting with Users via Zabbix API
#
# @return [String]
def method_name
'user'
end
# The keys field name used for User objects via Zabbix API
#
# @return [String]
def keys
'userids'
end
# The ke... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
express42/zabbixapi | https://github.com/express42/zabbixapi/blob/d8f23720aaf1bb6928414c91e02f426dac699c30/lib/zabbixapi/classes/actions.rb | lib/zabbixapi/classes/actions.rb | class ZabbixApi
class Actions < Basic
# The method name used for interacting with Actions via Zabbix API
#
# @return [String]
def method_name
'action'
end
# The id field name used for identifying specific Action objects via Zabbix API
#
# @return [String]
def identify
... | ruby | MIT | d8f23720aaf1bb6928414c91e02f426dac699c30 | 2026-01-04T17:47:42.006756Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.