Class: ZOOM::Package

Inherits:
Object
  • Object
show all
Defined in:
ext/rbzoompackage.c,
ext/rbzoompackage.c

Overview

This class represents an Extended Services Package: an instruction to the server to do something not covered by the core parts of the Z39.50 standard

Instance Method Summary collapse

Instance Method Details

#get_option(key) ⇒ Object

key: the name of the option, as a string.

Gets the value of a package’s option.

Returns: the value of the given option, as a string, integer or boolean.



114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'ext/rbzoompackage.c', line 114

static VALUE
rbz_package_get_option (VALUE self, VALUE key)
{
	ZOOM_package package;
    const char *value;
 
    package = rbz_package_get (self);
 
    value = ZOOM_package_option_get (package,
                                        RVAL2CSTR (key));

    return zoom_option_value_to_ruby_value (value);
}

#send(type) ⇒ Object

type: the actual extended service package type to be sent, as a string.

Sends the package.

Returns: self.



138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'ext/rbzoompackage.c', line 138

static VALUE
rbz_package_send(VALUE self, VALUE type)
{
    ZOOM_package package;
	const char *typeChar;

    package = rbz_package_get (self);

    typeChar = StringValuePtr(type);
    ZOOM_package_send(package, typeChar);
  
    return self;
}

#set_option(key, value) ⇒ Object

key: the name of the option, as a string.

value: the value of this option (as a string, integer or boolean).

Sets an option on the package.

Returns: self.



89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'ext/rbzoompackage.c', line 89

static VALUE
rbz_package_set_option (VALUE self, VALUE key, VALUE val)
{   

	ZOOM_package package;
    
    package = rbz_package_get (self);
    ZOOM_package_option_set (package,
                                RVAL2CSTR (key),
                                RVAL2CSTR (rb_obj_as_string (val)));
   
    return self;
}