Class: FbGraph::Offer

Inherits:
Node
  • Object
show all
Extended by:
Searchable
Defined in:
lib/fb_graph/offer.rb

Constant Summary collapse

ATTRS =
[ :from,
:title,
:created_time,
:expiration_time,
:terms,
:image_url,
:coupon_type,
:claim_limit,
:redemption_link,
:redemption_code]

Instance Attribute Summary

Attributes inherited from Node

#access_token, #endpoint, #identifier, #raw_attributes

Instance Method Summary collapse

Methods included from Searchable

search, search, search_query_param

Methods inherited from Node

#connection, #destroy, fetch, #fetch, #update

Methods included from Comparison

#==

Constructor Details

#initialize(identifier, attributes = {}) ⇒ Offer

Returns a new instance of Offer.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fb_graph/offer.rb', line 18

def initialize(identifier, attributes = {})
  super

  @from = Page.new(attributes[:from][:id], attributes[:from]) if attributes[:from]
  @title = attributes[:title]
  @created_time = Time.parse(attributes[:created_time]).utc if attributes[:created_time]
  @expiration_time = Time.parse(attributes[:expiration_time]).utc
  @terms = attributes[:terms] if attributes[:terms]
  @image_url = attributes[:image_url] if attributes[:image_url]
  @coupon_type = attributes[:coupon_type] if attributes[:coupon_type]
  @claim_limit = attributes[:claim_limit] if attributes[:claim_limit]
  @redemption_link = attributes[:redemption_link] if attributes[:redemption_link]
  @redemption_code = attributes[:redemption_code] if attributes[:redemption_code]
end