Class: Jyte::Contact
Overview
An API-Class that uses the Contact API
Usage
me = Jyte::Contact.new("claimid.com/judofyr")
me.roster #=> Array with my contacts
# You can use the default parameters:
me.is_member(:contact_openid => "friend") #=> true
# Or just the parameter
me.is_member("friend") #=> true
fake = Jyte::Contact.new("fake.example.com")
fake.roster #=> Raise JyteError with the error from the Jyte API
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(openid) ⇒ Contact
constructor
Sets the url to
http://jyte.com/api/contacts/
and default-parameters to { :openid => your_open_id }. -
#is_member(arg, options = {}) ⇒ Object
Hardcoded way to use is_member.
Methods inherited from Base
#base_url, #default, #method_missing, #to_s, #url
Constructor Details
#initialize(openid) ⇒ Contact
Sets the url to http://jyte.com/api/contacts/
and default-parameters to { :openid => your_open_id }
17 18 19 20 21 |
# File 'lib/jyte/contact.rb', line 17 def initialize(openid) url 'contacts' default :openid => openid @name = openid 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 :contact_openid.
25 26 27 28 |
# File 'lib/jyte/contact.rb', line 25 def is_member(arg, = {}) arg = { :contact_openid => arg } unless arg.is_a? Hash super(arg.merge()) end |