Class: Yo
Instance Attribute Summary collapse
-
#api_key ⇒ Object
writeonly
Sets the attribute api_key.
Class Method Summary collapse
- .all ⇒ Object
- .all! ⇒ Object
-
.api_key ⇒ Object
Authentication stuffs.
- .api_key=(api_key) ⇒ Object
- .api_key? ⇒ Boolean
- .from(params, username) ⇒ Object
-
.receive(params) {|parameters[:username].to_s| ... } ⇒ Object
Receive a yo.
- .subscribers ⇒ Object
- .subscribers? ⇒ Boolean
-
.yo(username) ⇒ Object
Yo calls.
- .yo!(username) ⇒ Object
Instance Attribute Details
#api_key=(value) ⇒ Object (writeonly)
Sets the attribute api_key
14 15 16 |
# File 'lib/yo-ruby.rb', line 14 def api_key=(value) @api_key = value end |
Class Method Details
.all ⇒ Object
42 43 44 |
# File 'lib/yo-ruby.rb', line 42 def self.all self.__post('/yoall/')["result"] == "OK" end |
.all! ⇒ Object
46 47 48 |
# File 'lib/yo-ruby.rb', line 46 def self.all! self.all end |
.api_key ⇒ Object
Authentication stuffs.
17 18 19 |
# File 'lib/yo-ruby.rb', line 17 def self.api_key @api_key end |
.api_key=(api_key) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/yo-ruby.rb', line 25 def self.api_key=(api_key) if api_key.to_s.length != 36 or not api_key.is_a?(String) raise YoException.new("Invalid Yo API key - must be 36 characters in length") end @api_key = api_key end |
.api_key? ⇒ Boolean
21 22 23 |
# File 'lib/yo-ruby.rb', line 21 def self.api_key? not @api_key.nil? end |
.from(params, username) ⇒ Object
64 65 66 67 |
# File 'lib/yo-ruby.rb', line 64 def self.from(params, username) parameters = __clean(params) yield if parameters.keys.length > 0 and parameters.include?(:username) end |
.receive(params) {|parameters[:username].to_s| ... } ⇒ Object
Receive a yo.
59 60 61 62 |
# File 'lib/yo-ruby.rb', line 59 def self.receive(params) parameters = __clean(params) yield(parameters[:username].to_s) if parameters.keys.length > 0 and parameters.include?(:username) end |
.subscribers ⇒ Object
50 51 52 |
# File 'lib/yo-ruby.rb', line 50 def self.subscribers self.__get('/subscribers_count/')["result"].to_i end |
.subscribers? ⇒ Boolean
54 55 56 |
# File 'lib/yo-ruby.rb', line 54 def self.subscribers? self.subscribers > 0 end |
.yo(username) ⇒ Object
Yo calls.
34 35 36 |
# File 'lib/yo-ruby.rb', line 34 def self.yo(username) self.__post('/yo/', { :username => username })["result"] == "OK" end |
.yo!(username) ⇒ Object
38 39 40 |
# File 'lib/yo-ruby.rb', line 38 def self.yo!(username) self.yo(username) end |