fb_graph 1.5.5 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.5
1
+ 1.6.0
data/fb_graph.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fb_graph}
8
- s.version = "1.5.5"
8
+ s.version = "1.6.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["nov matake"]
@@ -92,6 +92,8 @@ Gem::Specification.new do |s|
92
92
  "lib/fb_graph/node.rb",
93
93
  "lib/fb_graph/note.rb",
94
94
  "lib/fb_graph/page.rb",
95
+ "lib/fb_graph/page/categories.rb",
96
+ "lib/fb_graph/page/categories/local_business.rb",
95
97
  "lib/fb_graph/photo.rb",
96
98
  "lib/fb_graph/place.rb",
97
99
  "lib/fb_graph/post.rb",
@@ -0,0 +1,38 @@
1
+ module FbGraph
2
+ class Page
3
+ module Categories
4
+ module LocalBusiness
5
+ attr_accessor :attire, :general_manager, :hours, :parking, :payment_options, :phone, :price_range, :public_transit, :restaurant_services, :restaurant_specialties
6
+
7
+ def self.included(klass)
8
+ klass.alias_method_chain :initialize, :category_specific_attributes
9
+ end
10
+
11
+ def initialize_with_category_specific_attributes(identifier, attributes = {})
12
+ initialize_without_category_specific_attributes identifier, attributes
13
+ [:attire, :general_manager, :phone, :price_range, :public_transit].each do |key|
14
+ self.send :"#{key}=", attributes[key]
15
+ end
16
+ [:parking, :payment_options, :restaurant_services, :restaurant_specialties].each do |key|
17
+ self.send :"#{key}=", []
18
+ if attributes[key]
19
+ self.send :"#{key}=", attributes[key].keys.collect(&:to_sym)
20
+ end
21
+ end
22
+ @hours = {}
23
+ if attributes[:hours]
24
+ utc_beginning_of_day = Time.now.utc.beginning_of_day
25
+ attributes[:hours].each do |key, value|
26
+ date, index, mode = key.split('_')
27
+ index = index.to_i - 1
28
+ date, mode = date.to_sym, mode.to_sym
29
+ @hours[date] ||= []
30
+ @hours[date][index] ||= {}
31
+ @hours[date][index][mode] = value.since(utc_beginning_of_day)
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,9 @@
1
+ Dir[File.dirname(__FILE__) + '/categories/*.rb'].each do |file|
2
+ require file
3
+ end
4
+
5
+ module FbGraph
6
+ class Page
7
+ include Categories::LocalBusiness
8
+ end
9
+ end
data/lib/fb_graph/page.rb CHANGED
@@ -16,7 +16,7 @@ module FbGraph
16
16
  include Connections::Videos
17
17
  extend Searchable
18
18
 
19
- attr_accessor :name, :username, :link, :category, :founded, :can_post, :is_community_page, :company_overview, :general_info, :mission, :products, :release_date, :location, :website, :websites, :like_count, :checkin_count, :with, :created_time
19
+ attr_accessor :name, :username, :link, :category, :founded, :can_post, :is_community_page, :company_overview, :general_info, :mission, :products, :public_transit, :release_date, :location, :website, :websites, :like_count, :checkin_count, :with, :created_time
20
20
 
21
21
  def initialize(identifier, attributes = {})
22
22
  super
@@ -32,9 +32,8 @@ module FbGraph
32
32
  @company_overview = attributes[:company_overview]
33
33
  @general_info = attributes[:general_info]
34
34
  @mission = attributes[:mission]
35
- if (products = attributes[:products])
36
- @products = products.split("\n")
37
- end
35
+ @products = attributes[:products]
36
+ @public_transit = attributes[:public_transit]
38
37
  if (release_date = attributes[:release_date])
39
38
  @release_date = Date.parse(release_date) rescue release_date
40
39
  end
@@ -56,4 +55,6 @@ module FbGraph
56
55
  end
57
56
  end
58
57
  end
59
- end
58
+ end
59
+
60
+ require 'fb_graph/page/categories'
data/lib/fb_graph/user.rb CHANGED
@@ -57,7 +57,6 @@ module FbGraph
57
57
  end
58
58
  @email = attributes[:email]
59
59
  @website = attributes[:website]
60
- @websites = attributes[:website].to_s.split
61
60
  if (hometown = attributes[:hometown])
62
61
  @hometown = Page.new(hometown.delete(:id), hometown)
63
62
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fb_graph
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 5
9
- - 5
10
- version: 1.5.5
8
+ - 6
9
+ - 0
10
+ version: 1.6.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - nov matake
@@ -210,6 +210,8 @@ files:
210
210
  - lib/fb_graph/node.rb
211
211
  - lib/fb_graph/note.rb
212
212
  - lib/fb_graph/page.rb
213
+ - lib/fb_graph/page/categories.rb
214
+ - lib/fb_graph/page/categories/local_business.rb
213
215
  - lib/fb_graph/photo.rb
214
216
  - lib/fb_graph/place.rb
215
217
  - lib/fb_graph/post.rb