Class: PFBadge
- Inherits:
-
Object
- Object
- PFBadge
- Defined in:
- lib/awardflair/pickflair_api.rb
Overview
require ‘yajl/yajl’
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#pickflair_instance ⇒ Object
Returns the value of attribute pickflair_instance.
-
#picture_url ⇒ Object
Returns the value of attribute picture_url.
Instance Method Summary collapse
- #award ⇒ Object
- #award_to(email_of_recipient, options = {}) ⇒ Object
-
#initialize(attributes = {}) ⇒ PFBadge
constructor
A new instance of PFBadge.
- #qualify?(search_terms) ⇒ Boolean
Constructor Details
#initialize(attributes = {}) ⇒ PFBadge
Returns a new instance of PFBadge.
7 8 9 10 11 |
# File 'lib/awardflair/pickflair_api.rb', line 7 def initialize(attributes={}) attributes.each do |key, value| instance_variable_set("@#{key}", value) unless value.nil? end end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
5 6 7 |
# File 'lib/awardflair/pickflair_api.rb', line 5 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/awardflair/pickflair_api.rb', line 5 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/awardflair/pickflair_api.rb', line 5 def name @name end |
#pickflair_instance ⇒ Object
Returns the value of attribute pickflair_instance.
5 6 7 |
# File 'lib/awardflair/pickflair_api.rb', line 5 def pickflair_instance @pickflair_instance end |
#picture_url ⇒ Object
Returns the value of attribute picture_url.
5 6 7 |
# File 'lib/awardflair/pickflair_api.rb', line 5 def picture_url @picture_url end |
Instance Method Details
#award ⇒ Object
23 24 25 |
# File 'lib/awardflair/pickflair_api.rb', line 23 def award pickflair_instance.award_badge(@id) end |
#award_to(email_of_recipient, options = {}) ⇒ Object
27 28 29 |
# File 'lib/awardflair/pickflair_api.rb', line 27 def award_to(email_of_recipient, ={}) pickflair_instance.award_badge_by_email(@id, email_of_recipient, ) end |
#qualify?(search_terms) ⇒ Boolean
13 14 15 16 17 18 19 20 21 |
# File 'lib/awardflair/pickflair_api.rb', line 13 def qualify?(search_terms) search_terms.each do |key, value| if value == self.send(key.to_sym) self else return false && break end end end |