fb_graph 1.6.3 → 1.6.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.3
1
+ 1.6.4
data/fb_graph.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fb_graph}
8
- s.version = "1.6.3"
8
+ s.version = "1.6.4"
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"]
12
- s.date = %q{2011-03-22}
12
+ s.date = %q{2011-03-30}
13
13
  s.description = %q{A full-stack Facebook Graph API wrapper in Ruby.}
14
14
  s.email = %q{nov@matake.jp}
15
15
  s.extra_rdoc_files = [
@@ -69,6 +69,7 @@ Gem::Specification.new do |s|
69
69
  "lib/fb_graph/connections/noreply.rb",
70
70
  "lib/fb_graph/connections/notes.rb",
71
71
  "lib/fb_graph/connections/participants.rb",
72
+ "lib/fb_graph/connections/payments.rb",
72
73
  "lib/fb_graph/connections/photos.rb",
73
74
  "lib/fb_graph/connections/picture.rb",
74
75
  "lib/fb_graph/connections/posts.rb",
@@ -91,6 +92,7 @@ Gem::Specification.new do |s|
91
92
  "lib/fb_graph/message.rb",
92
93
  "lib/fb_graph/node.rb",
93
94
  "lib/fb_graph/note.rb",
95
+ "lib/fb_graph/order.rb",
94
96
  "lib/fb_graph/page.rb",
95
97
  "lib/fb_graph/page/category_attributes.rb",
96
98
  "lib/fb_graph/photo.rb",
@@ -6,6 +6,7 @@ module FbGraph
6
6
  include Connections::Insights
7
7
  include Connections::Links
8
8
  include Connections::Notes
9
+ include Connections::Payments
9
10
  include Connections::Photos
10
11
  include Connections::Picture
11
12
  include Connections::Posts
@@ -0,0 +1,15 @@
1
+ module FbGraph
2
+ module Connections
3
+ module Payments
4
+ def payments(options = {})
5
+ options[:access_token] ||= self.access_token
6
+ options[:access_token] ||= get_access_token(options[:secret]) if respond_to?(:get_access_token)
7
+ orders = self.connection(:payments, options)
8
+ orders.map! do |order|
9
+ orders[:access_token] ||= options[:access_token] || self.access_token
10
+ Order.new(order.delete(:id), order)
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -31,9 +31,9 @@ module FbGraph
31
31
  if (end_time = attributes[:end_time])
32
32
  @end_time = case end_time
33
33
  when String
34
- Time.parse(end_time).utc
34
+ Time.parse(end_time)
35
35
  when Fixnum
36
- Time.at(end_time).utc
36
+ Time.at(end_time)
37
37
  end
38
38
  end
39
39
  if attributes[:venue]
@@ -0,0 +1,51 @@
1
+ module FbGraph
2
+ class Order < Node
3
+ attr_accessor :application, :from, :to, :amount, :status, :country, :created_time, :updated_time
4
+
5
+ def initialize(identifier, attributes = {})
6
+ super
7
+ if application = attributes[:application]
8
+ @application = Application.new(app.delete(:id), app)
9
+ end
10
+ if from = attributes[:from]
11
+ @from = User.new(from.delete(:id), from)
12
+ end
13
+ if to = attributes[:to]
14
+ @to = User.new(to.delete(:id), to)
15
+ end
16
+ @status = attributes[:status]
17
+ @country = attributes[:country]
18
+ if attributes[:created_time]
19
+ @created_time = Time.parse(attributes[:created_time]).utc
20
+ end
21
+ if attributes[:updated_time]
22
+ @updated_time = Time.parse(attributes[:updated_time]).utc
23
+ end
24
+ end
25
+
26
+ def settled!(options = {})
27
+ update options.merge(:status => :settled)
28
+ end
29
+
30
+ def refunded!(options = {})
31
+ update options.merge(:status => :refunded, :refund_funding_source => true)
32
+ end
33
+
34
+ def canceled!(options = {})
35
+ update options.merge(:status => :canceled)
36
+ end
37
+
38
+ def update(attributes = {})
39
+ _attributes_ = attributes.dup
40
+ params = {
41
+ :access_token => self.access_token,
42
+ :status => _attributes_.delete(:status),
43
+ :message => _attributes_.delete(:message),
44
+ :refund_funding_source => _attributes_.delete(:refund_funding_source),
45
+ :refund_reason => _attributes_.delete(:refund_reason),
46
+ :params => _attributes_.to_json
47
+ }
48
+ post params
49
+ end
50
+ end
51
+ end
data/lib/fb_graph/user.rb CHANGED
@@ -19,6 +19,7 @@ module FbGraph
19
19
  include Connections::Movies
20
20
  include Connections::Music
21
21
  include Connections::Notes
22
+ include Connections::Payments
22
23
  include Connections::Photos
23
24
  include Connections::Picture
24
25
  include Connections::Posts
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: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 6
9
- - 3
10
- version: 1.6.3
9
+ - 4
10
+ version: 1.6.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - nov matake
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-22 00:00:00 +09:00
18
+ date: 2011-03-30 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -186,6 +186,7 @@ files:
186
186
  - lib/fb_graph/connections/noreply.rb
187
187
  - lib/fb_graph/connections/notes.rb
188
188
  - lib/fb_graph/connections/participants.rb
189
+ - lib/fb_graph/connections/payments.rb
189
190
  - lib/fb_graph/connections/photos.rb
190
191
  - lib/fb_graph/connections/picture.rb
191
192
  - lib/fb_graph/connections/posts.rb
@@ -208,6 +209,7 @@ files:
208
209
  - lib/fb_graph/message.rb
209
210
  - lib/fb_graph/node.rb
210
211
  - lib/fb_graph/note.rb
212
+ - lib/fb_graph/order.rb
211
213
  - lib/fb_graph/page.rb
212
214
  - lib/fb_graph/page/category_attributes.rb
213
215
  - lib/fb_graph/photo.rb