Module: FbGraph::Page::Categories::LocalBusiness

Included in:
FbGraph::Page
Defined in:
lib/fb_graph/page/categories/local_business.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attireObject

Returns the value of attribute attire.



5
6
7
# File 'lib/fb_graph/page/categories/local_business.rb', line 5

def attire
  @attire
end

#general_managerObject

Returns the value of attribute general_manager.



5
6
7
# File 'lib/fb_graph/page/categories/local_business.rb', line 5

def general_manager
  @general_manager
end

#hoursObject

Returns the value of attribute hours.



5
6
7
# File 'lib/fb_graph/page/categories/local_business.rb', line 5

def hours
  @hours
end

#parkingObject

Returns the value of attribute parking.



5
6
7
# File 'lib/fb_graph/page/categories/local_business.rb', line 5

def parking
  @parking
end

#payment_optionsObject

Returns the value of attribute payment_options.



5
6
7
# File 'lib/fb_graph/page/categories/local_business.rb', line 5

def payment_options
  @payment_options
end

#phoneObject

Returns the value of attribute phone.



5
6
7
# File 'lib/fb_graph/page/categories/local_business.rb', line 5

def phone
  @phone
end

#price_rangeObject

Returns the value of attribute price_range.



5
6
7
# File 'lib/fb_graph/page/categories/local_business.rb', line 5

def price_range
  @price_range
end

#public_transitObject

Returns the value of attribute public_transit.



5
6
7
# File 'lib/fb_graph/page/categories/local_business.rb', line 5

def public_transit
  @public_transit
end

#restaurant_servicesObject

Returns the value of attribute restaurant_services.



5
6
7
# File 'lib/fb_graph/page/categories/local_business.rb', line 5

def restaurant_services
  @restaurant_services
end

#restaurant_specialtiesObject

Returns the value of attribute restaurant_specialties.



5
6
7
# File 'lib/fb_graph/page/categories/local_business.rb', line 5

def restaurant_specialties
  @restaurant_specialties
end

Class Method Details

.included(klass) ⇒ Object



7
8
9
# File 'lib/fb_graph/page/categories/local_business.rb', line 7

def self.included(klass)
  klass.alias_method_chain :initialize, :category_specific_attributes
end

Instance Method Details

#initialize_with_category_specific_attributes(identifier, attributes = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/fb_graph/page/categories/local_business.rb', line 11

def initialize_with_category_specific_attributes(identifier, attributes = {})
  initialize_without_category_specific_attributes identifier, attributes
  [:attire, :general_manager, :phone, :price_range, :public_transit].each do |key|
    self.send :"#{key}=", attributes[key]
  end
  [:parking, :payment_options, :restaurant_services, :restaurant_specialties].each do |key|
    self.send :"#{key}=", []
    if attributes[key]
      self.send :"#{key}=", attributes[key].keys.collect(&:to_sym)
    end
  end
  @hours = {}
  if attributes[:hours]
    utc_beginning_of_day = Time.now.utc.beginning_of_day
    attributes[:hours].each do |key, value|
      date, index, mode = key.split('_')
      index = index.to_i - 1
      date, mode = date.to_sym, mode.to_sym
      @hours[date] ||= []
      @hours[date][index] ||= {}
      @hours[date][index][mode] = value.since(utc_beginning_of_day)
    end
  end
end