Class: Jyte::Group

Inherits:
Base
  • Object
show all
Defined in:
lib/jyte/group.rb

Overview

An API-Class that uses the Group API

Usage

linux = Jyte::Group.new("Linux")
linux.roster         #=> Array with all the members

me = Jyte::Contact.new("claimid.com/judofyr")
linux.is_member(me)  #=> true

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#base_url, #default, #method_missing, #to_s, #url

Constructor Details

#initialize(name) ⇒ Group

Sets the url to http://jyte.com/api/group/GROUPNAME/



12
13
14
15
# File 'lib/jyte/group.rb', line 12

def initialize(name)
  url 'group', name
  @name = name
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Jyte::Base

Instance Method Details

#is_member(arg, options = {}) ⇒ Object

Hardcoded way to use is_member. If arg isn’t a Hash, it makes it the value to :openid.



19
20
21
22
# File 'lib/jyte/group.rb', line 19

def is_member(arg, options = {})
  arg = { :openid => arg } unless arg.is_a? Hash
  super(arg.merge(options))
end