fb_graph 1.9.3 → 1.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +5 -0
- data/Gemfile.lock +9 -2
- data/README.rdoc +4 -1
- data/VERSION +1 -1
- data/lib/fb_graph/application.rb +2 -0
- data/lib/fb_graph/connection.rb +1 -0
- data/lib/fb_graph/connections/payments.rb +3 -3
- data/lib/fb_graph/order.rb +3 -8
- data/spec/fb_graph/connections/payments_spec.rb +17 -0
- data/spec/fb_graph/connections/photos_spec.rb +2 -2
- data/spec/fb_graph/order_spec.rb +19 -0
- data/spec/mock_json/applications/payments/sample.json +25 -0
- metadata +8 -45
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fb_graph (1.9.
|
4
|
+
fb_graph (1.9.3)
|
5
5
|
httpclient (>= 2.2.0.2)
|
6
6
|
rack-oauth2 (>= 0.8.0)
|
7
7
|
|
@@ -26,6 +26,7 @@ GEM
|
|
26
26
|
activesupport (3.0.9)
|
27
27
|
addressable (2.2.6)
|
28
28
|
attr_required (0.0.3)
|
29
|
+
bouncy-castle-java (1.5.0146.1)
|
29
30
|
builder (2.1.2)
|
30
31
|
crack (0.1.8)
|
31
32
|
diff-lcs (1.1.2)
|
@@ -33,11 +34,14 @@ GEM
|
|
33
34
|
abstract (>= 1.0.0)
|
34
35
|
httpclient (2.2.1)
|
35
36
|
i18n (0.5.0)
|
37
|
+
jruby-openssl (0.7.4)
|
38
|
+
bouncy-castle-java
|
36
39
|
json (1.5.3)
|
40
|
+
json (1.5.3-java)
|
37
41
|
rack (1.2.3)
|
38
42
|
rack-mount (0.6.14)
|
39
43
|
rack (>= 1.0.0)
|
40
|
-
rack-oauth2 (0.8.
|
44
|
+
rack-oauth2 (0.8.4)
|
41
45
|
activesupport (>= 2.3)
|
42
46
|
attr_required (>= 0.0.3)
|
43
47
|
httpclient (>= 2.2.0.2)
|
@@ -48,6 +52,7 @@ GEM
|
|
48
52
|
rack (>= 1.0)
|
49
53
|
rake (0.9.2)
|
50
54
|
rcov (0.9.9)
|
55
|
+
rcov (0.9.9-java)
|
51
56
|
rspec (2.6.0)
|
52
57
|
rspec-core (~> 2.6.0)
|
53
58
|
rspec-expectations (~> 2.6.0)
|
@@ -62,11 +67,13 @@ GEM
|
|
62
67
|
crack (>= 0.1.7)
|
63
68
|
|
64
69
|
PLATFORMS
|
70
|
+
java
|
65
71
|
ruby
|
66
72
|
|
67
73
|
DEPENDENCIES
|
68
74
|
actionpack (>= 3.0.6)
|
69
75
|
fb_graph!
|
76
|
+
jruby-openssl (>= 0.7)
|
70
77
|
rake (>= 0.8)
|
71
78
|
rcov (>= 0.9)
|
72
79
|
rspec (>= 2)
|
data/README.rdoc
CHANGED
@@ -21,6 +21,9 @@ Almost all connections for each object are also supported. ("attachments" and
|
|
21
21
|
|
22
22
|
You can also play with a Rails sample app here. http://fbgraphsample.heroku.com/
|
23
23
|
|
24
|
+
See GitHub wiki for more examples.
|
25
|
+
https://github.com/nov/fb_graph/wiki
|
26
|
+
|
24
27
|
=== GET
|
25
28
|
|
26
29
|
==== Basic Objects
|
@@ -175,7 +178,7 @@ You can also play with a Rails sample app here. http://fbgraphsample.heroku.com/
|
|
175
178
|
album = me.albums.first
|
176
179
|
album.photo!(
|
177
180
|
:access_token => ACCESS_TOKEN,
|
178
|
-
:
|
181
|
+
:source => File.new('/Users/nov/Desktop/nov.gif', 'rb'), # 'rb' is needed only on windows
|
179
182
|
:message => 'Hello, where is photo?'
|
180
183
|
)
|
181
184
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.9.
|
1
|
+
1.9.4
|
data/lib/fb_graph/application.rb
CHANGED
@@ -16,6 +16,8 @@ module FbGraph
|
|
16
16
|
include Connections::Subscriptions
|
17
17
|
include Connections::Tagged
|
18
18
|
include Connections::TestUsers
|
19
|
+
# TODO
|
20
|
+
# include Connections::Translations
|
19
21
|
include Connections::Videos
|
20
22
|
|
21
23
|
attr_accessor :name, :description, :category, :link, :secret
|
data/lib/fb_graph/connection.rb
CHANGED
@@ -2,11 +2,11 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module Payments
|
4
4
|
def payments(options = {})
|
5
|
-
options[:access_token] ||= self.access_token
|
6
5
|
orders = self.connection(:payments, options)
|
7
6
|
orders.map! do |order|
|
8
|
-
|
9
|
-
|
7
|
+
Order.new(order[:id], order.merge(
|
8
|
+
:access_token => options[:access_token] || self.access_token
|
9
|
+
))
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
data/lib/fb_graph/order.rb
CHANGED
@@ -28,12 +28,7 @@ module FbGraph
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def refunded!(options = {})
|
31
|
-
|
32
|
-
:status => :refunded,
|
33
|
-
:message => "Refunded", # message is currently required by facebook in a refund
|
34
|
-
:refund_funding_source => true
|
35
|
-
}
|
36
|
-
update defaults.merge(options)
|
31
|
+
update options.merge(:status => :refunded)
|
37
32
|
end
|
38
33
|
|
39
34
|
def canceled!(options = {})
|
@@ -48,9 +43,9 @@ module FbGraph
|
|
48
43
|
:message => _attributes_.delete(:message),
|
49
44
|
:refund_funding_source => _attributes_.delete(:refund_funding_source),
|
50
45
|
:refund_reason => _attributes_.delete(:refund_reason),
|
51
|
-
:params => _attributes_
|
46
|
+
:params => _attributes_
|
52
47
|
}
|
53
|
-
|
48
|
+
super params
|
54
49
|
end
|
55
50
|
end
|
56
51
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FbGraph::Connections::Payments do
|
4
|
+
describe '#payments' do
|
5
|
+
let(:app) { FbGraph::Application.new('app_id', :secret => 'sec sec') }
|
6
|
+
|
7
|
+
it 'should return payments as FbGraph::Order' do
|
8
|
+
mock_graph :post, 'oauth/access_token', 'token_response' do
|
9
|
+
mock_graph :get, 'app_id/payments', 'applications/payments/sample', :access_token => 'token' do
|
10
|
+
app.payments.each do |payment|
|
11
|
+
payment.should be_a FbGraph::Order
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -17,7 +17,7 @@ describe FbGraph::Connections::Photos, '#photo!' do
|
|
17
17
|
it 'should return generated photo' do
|
18
18
|
mock_graph :post, '12345/photos', 'albums/photos/post_with_valid_access_token' do
|
19
19
|
photo = FbGraph::Album.new('12345', :access_token => 'valid').photo!(
|
20
|
-
:
|
20
|
+
:source => Tempfile.new('image_file'),
|
21
21
|
:message => 'Hello, where is photo?'
|
22
22
|
)
|
23
23
|
photo.identifier.should == 401111132276
|
@@ -29,7 +29,7 @@ describe FbGraph::Connections::Photos, '#photo!' do
|
|
29
29
|
it 'should support Tag' do
|
30
30
|
mock_graph :post, '12345/photos', 'albums/photos/post_with_valid_access_token' do
|
31
31
|
photo = FbGraph::Album.new('12345', :access_token => 'valid').photo!(
|
32
|
-
:
|
32
|
+
:source => Tempfile.new('image_file'),
|
33
33
|
:message => 'Hello, where is photo?',
|
34
34
|
:tags => [FbGraph::Tag.new(:id => 12345, :name => 'me', :x => 0, :y => 10)]
|
35
35
|
)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
{
|
2
|
+
"data": [{
|
3
|
+
"id": "9005218752778",
|
4
|
+
"from": {
|
5
|
+
"name": "Nov Matake",
|
6
|
+
"id": "579612276"
|
7
|
+
},
|
8
|
+
"to": {
|
9
|
+
"name": "Nov Matake",
|
10
|
+
"id": "579612276"
|
11
|
+
},
|
12
|
+
"amount": 2,
|
13
|
+
"status": "settled",
|
14
|
+
"application": {
|
15
|
+
"name": "gem sample",
|
16
|
+
"id": "134145643294322"
|
17
|
+
},
|
18
|
+
"created_time": "2011-07-22T09:42:12+0000",
|
19
|
+
"updated_time": "2011-07-22T09:42:15+0000"
|
20
|
+
}],
|
21
|
+
"paging": {
|
22
|
+
"previous": "https://graph.facebook.com/134145643294322/payments?access_token=access_token&limit=1000&since=1311327735",
|
23
|
+
"next": "https://graph.facebook.com/134145643294322/payments?access_token=access_token&limit=1000&until=1311327735"
|
24
|
+
}
|
25
|
+
}
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fb_graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 53
|
5
4
|
prerelease:
|
6
|
-
|
7
|
-
- 1
|
8
|
-
- 9
|
9
|
-
- 3
|
10
|
-
version: 1.9.3
|
5
|
+
version: 1.9.4
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- nov matake
|
@@ -15,7 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-07-
|
13
|
+
date: 2011-07-24 00:00:00 Z
|
19
14
|
dependencies:
|
20
15
|
- !ruby/object:Gem::Dependency
|
21
16
|
name: httpclient
|
@@ -25,12 +20,6 @@ dependencies:
|
|
25
20
|
requirements:
|
26
21
|
- - ">="
|
27
22
|
- !ruby/object:Gem::Version
|
28
|
-
hash: 123
|
29
|
-
segments:
|
30
|
-
- 2
|
31
|
-
- 2
|
32
|
-
- 0
|
33
|
-
- 2
|
34
23
|
version: 2.2.0.2
|
35
24
|
type: :runtime
|
36
25
|
version_requirements: *id001
|
@@ -42,11 +31,6 @@ dependencies:
|
|
42
31
|
requirements:
|
43
32
|
- - ">="
|
44
33
|
- !ruby/object:Gem::Version
|
45
|
-
hash: 63
|
46
|
-
segments:
|
47
|
-
- 0
|
48
|
-
- 8
|
49
|
-
- 0
|
50
34
|
version: 0.8.0
|
51
35
|
type: :runtime
|
52
36
|
version_requirements: *id002
|
@@ -58,10 +42,6 @@ dependencies:
|
|
58
42
|
requirements:
|
59
43
|
- - ">="
|
60
44
|
- !ruby/object:Gem::Version
|
61
|
-
hash: 27
|
62
|
-
segments:
|
63
|
-
- 0
|
64
|
-
- 8
|
65
45
|
version: "0.8"
|
66
46
|
type: :development
|
67
47
|
version_requirements: *id003
|
@@ -73,10 +53,6 @@ dependencies:
|
|
73
53
|
requirements:
|
74
54
|
- - ">="
|
75
55
|
- !ruby/object:Gem::Version
|
76
|
-
hash: 25
|
77
|
-
segments:
|
78
|
-
- 0
|
79
|
-
- 9
|
80
56
|
version: "0.9"
|
81
57
|
type: :development
|
82
58
|
version_requirements: *id004
|
@@ -88,9 +64,6 @@ dependencies:
|
|
88
64
|
requirements:
|
89
65
|
- - ">="
|
90
66
|
- !ruby/object:Gem::Version
|
91
|
-
hash: 7
|
92
|
-
segments:
|
93
|
-
- 2
|
94
67
|
version: "2"
|
95
68
|
type: :development
|
96
69
|
version_requirements: *id005
|
@@ -102,11 +75,6 @@ dependencies:
|
|
102
75
|
requirements:
|
103
76
|
- - ">="
|
104
77
|
- !ruby/object:Gem::Version
|
105
|
-
hash: 11
|
106
|
-
segments:
|
107
|
-
- 1
|
108
|
-
- 6
|
109
|
-
- 2
|
110
78
|
version: 1.6.2
|
111
79
|
type: :development
|
112
80
|
version_requirements: *id006
|
@@ -118,11 +86,6 @@ dependencies:
|
|
118
86
|
requirements:
|
119
87
|
- - ">="
|
120
88
|
- !ruby/object:Gem::Version
|
121
|
-
hash: 11
|
122
|
-
segments:
|
123
|
-
- 3
|
124
|
-
- 0
|
125
|
-
- 6
|
126
89
|
version: 3.0.6
|
127
90
|
type: :development
|
128
91
|
version_requirements: *id007
|
@@ -296,6 +259,7 @@ files:
|
|
296
259
|
- spec/fb_graph/connections/notes_spec.rb
|
297
260
|
- spec/fb_graph/connections/outbox_spec.rb
|
298
261
|
- spec/fb_graph/connections/participants_spec.rb
|
262
|
+
- spec/fb_graph/connections/payments_spec.rb
|
299
263
|
- spec/fb_graph/connections/permissions_spec.rb
|
300
264
|
- spec/fb_graph/connections/photos_spec.rb
|
301
265
|
- spec/fb_graph/connections/picture_spec.rb
|
@@ -326,6 +290,7 @@ files:
|
|
326
290
|
- spec/fb_graph/message_spec.rb
|
327
291
|
- spec/fb_graph/node_spec.rb
|
328
292
|
- spec/fb_graph/note_spec.rb
|
293
|
+
- spec/fb_graph/order_spec.rb
|
329
294
|
- spec/fb_graph/page/local_business_spec.rb
|
330
295
|
- spec/fb_graph/page/movie_spec.rb
|
331
296
|
- spec/fb_graph/page/music_spec.rb
|
@@ -355,6 +320,7 @@ files:
|
|
355
320
|
- spec/mock_json/albums/photos/post_with_valid_access_token.json
|
356
321
|
- spec/mock_json/applications/accounts/private.json
|
357
322
|
- spec/mock_json/applications/feed/public.json
|
323
|
+
- spec/mock_json/applications/payments/sample.json
|
358
324
|
- spec/mock_json/applications/reviews/public.json
|
359
325
|
- spec/mock_json/applications/subscriptions/fb_graph_private.json
|
360
326
|
- spec/mock_json/applications/test_users/created.json
|
@@ -496,18 +462,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
496
462
|
requirements:
|
497
463
|
- - ">="
|
498
464
|
- !ruby/object:Gem::Version
|
499
|
-
hash: 3
|
500
|
-
segments:
|
501
|
-
- 0
|
502
465
|
version: "0"
|
503
466
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
504
467
|
none: false
|
505
468
|
requirements:
|
506
469
|
- - ">="
|
507
470
|
- !ruby/object:Gem::Version
|
508
|
-
hash: 3
|
509
|
-
segments:
|
510
|
-
- 0
|
511
471
|
version: "0"
|
512
472
|
requirements: []
|
513
473
|
|
@@ -561,6 +521,7 @@ test_files:
|
|
561
521
|
- spec/fb_graph/connections/notes_spec.rb
|
562
522
|
- spec/fb_graph/connections/outbox_spec.rb
|
563
523
|
- spec/fb_graph/connections/participants_spec.rb
|
524
|
+
- spec/fb_graph/connections/payments_spec.rb
|
564
525
|
- spec/fb_graph/connections/permissions_spec.rb
|
565
526
|
- spec/fb_graph/connections/photos_spec.rb
|
566
527
|
- spec/fb_graph/connections/picture_spec.rb
|
@@ -591,6 +552,7 @@ test_files:
|
|
591
552
|
- spec/fb_graph/message_spec.rb
|
592
553
|
- spec/fb_graph/node_spec.rb
|
593
554
|
- spec/fb_graph/note_spec.rb
|
555
|
+
- spec/fb_graph/order_spec.rb
|
594
556
|
- spec/fb_graph/page/local_business_spec.rb
|
595
557
|
- spec/fb_graph/page/movie_spec.rb
|
596
558
|
- spec/fb_graph/page/music_spec.rb
|
@@ -620,6 +582,7 @@ test_files:
|
|
620
582
|
- spec/mock_json/albums/photos/post_with_valid_access_token.json
|
621
583
|
- spec/mock_json/applications/accounts/private.json
|
622
584
|
- spec/mock_json/applications/feed/public.json
|
585
|
+
- spec/mock_json/applications/payments/sample.json
|
623
586
|
- spec/mock_json/applications/reviews/public.json
|
624
587
|
- spec/mock_json/applications/subscriptions/fb_graph_private.json
|
625
588
|
- spec/mock_json/applications/test_users/created.json
|