koala 2.0.0rc1 → 2.0.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.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/changelog.md +7 -0
- data/lib/koala/api/graph_api.rb +14 -3
- data/lib/koala/version.rb +1 -1
- data/readme.md +9 -2
- data/spec/cases/graph_api_batch_spec.rb +8 -0
- data/spec/fixtures/mock_facebook_responses.yml +4 -0
- data/spec/support/graph_api_shared_examples.rb +5 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cee1d15d3263d9cdfffa910b9127b4d6e177f844
|
4
|
+
data.tar.gz: db07b6f8a9443e34c717671756daa41138c408c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccba6c6fc0b52f5c22582f2438f53968c6e23c458d329be8cf18a997554043a8e433e97f464e03affdfcda6f530cd90b354ac8f6a0cf05d26ff72a23990bf69d
|
7
|
+
data.tar.gz: 33484fe1e975f2a3808f928a967ff7d054c8495f9185dd4975ce448cb301dbe9002b756d72d4e0a7bc9739e13f90ef42ed4f66254aeec83c0231841dc6df22ef
|
data/.travis.yml
CHANGED
data/changelog.md
CHANGED
@@ -16,6 +16,13 @@ refactors:
|
|
16
16
|
* OAuth methods for dealing with session tokens (which Facebook stopped
|
17
17
|
providing)
|
18
18
|
* OAuth#get\_user\_from\_cookies (use get\_user\_info\_from\_cookies instead)
|
19
|
+
* Blocks passed to API#get_picture will work in the batch API (thanks, cwhetung!)
|
20
|
+
* Added API#get_user_picture_data to get data about a picture (thanks, morgoth!)
|
21
|
+
|
22
|
+
Other changes:
|
23
|
+
|
24
|
+
* Test against modern Ruby versions on Travis (thanks, nicolasleger!)
|
25
|
+
* Speed up Travis builds (thanks, morgoth!)
|
19
26
|
|
20
27
|
v.1.11.1
|
21
28
|
========
|
data/lib/koala/api/graph_api.rb
CHANGED
@@ -177,10 +177,21 @@ module Koala
|
|
177
177
|
# @return the URL to the image
|
178
178
|
def get_picture(object, args = {}, options = {}, &block)
|
179
179
|
# Gets a picture object, returning the URL (which Facebook sends as a header)
|
180
|
-
|
181
|
-
result ? result["Location"] : nil
|
180
|
+
graph_call("#{object}/picture", args, "get", options.merge(:http_component => :headers)) do |result|
|
181
|
+
resolved_result = result ? result["Location"] : nil
|
182
|
+
block ? block.call(resolved_result) : resolved_result
|
182
183
|
end
|
183
|
-
|
184
|
+
end
|
185
|
+
|
186
|
+
# Fetches a photo data.
|
187
|
+
#
|
188
|
+
# @param args (see #get_object)
|
189
|
+
# @param options (see Koala::Facebook::API#api)
|
190
|
+
# @param block (see Koala::Facebook::API#api)
|
191
|
+
#
|
192
|
+
# @return a hash of object data
|
193
|
+
def get_user_picture_data(object, args = {}, options = {}, &block)
|
194
|
+
graph_call("#{object}/picture", args.merge(:redirect => false), "get", options, &block)
|
184
195
|
end
|
185
196
|
|
186
197
|
# Upload a photo.
|
data/lib/koala/version.rb
CHANGED
data/readme.md
CHANGED
@@ -15,14 +15,21 @@ Installation
|
|
15
15
|
|
16
16
|
In Bundler:
|
17
17
|
```ruby
|
18
|
-
gem "koala", "~>
|
18
|
+
gem "koala", "~> 2.0"
|
19
19
|
```
|
20
20
|
|
21
21
|
Otherwise:
|
22
22
|
```bash
|
23
|
-
[sudo|rvm] gem install koala
|
23
|
+
[sudo|rvm] gem install koala
|
24
24
|
```
|
25
25
|
|
26
|
+
Upgrading to 2.0
|
27
|
+
---------
|
28
|
+
|
29
|
+
Koala 2.0 is not a major refactor, but rather a set of small, mostly internal
|
30
|
+
refactors, which should not require significant changes by users. See changelog.md for more
|
31
|
+
details.
|
32
|
+
|
26
33
|
Graph API
|
27
34
|
---------
|
28
35
|
|
@@ -523,6 +523,14 @@ describe "Koala::Facebook::GraphAPI in batch mode" do
|
|
523
523
|
expect(pictures.first).to match(/http\:\/\//) # works both live & stubbed
|
524
524
|
end
|
525
525
|
|
526
|
+
it 'takes an after processing block for a get_picture call inside of a batch' do
|
527
|
+
picture = nil
|
528
|
+
@api.batch do |batch_api|
|
529
|
+
batch_api.get_picture('me') { |pic| picture = pic }
|
530
|
+
end
|
531
|
+
expect(picture).to match(/http\:\/\//) # works both live & stubbed
|
532
|
+
end
|
533
|
+
|
526
534
|
it "handles requests for two different tokens" do
|
527
535
|
me, insights = @api.batch do |batch_api|
|
528
536
|
batch_api.get_object('me')
|
@@ -241,6 +241,10 @@ graph_api:
|
|
241
241
|
headers:
|
242
242
|
Location: https://facebook.com/large
|
243
243
|
|
244
|
+
redirect=false:
|
245
|
+
get:
|
246
|
+
no_token: '{"is_silhouette": true, "url": "https://facebook.com/large"}'
|
247
|
+
with_token: '{"is_silhouette": true, "url": "https://facebook.com/large"}'
|
244
248
|
/comments:
|
245
249
|
ids=http://developers.facebook.com/blog/post/472:
|
246
250
|
get:
|
@@ -97,6 +97,11 @@ shared_examples_for "Koala GraphAPI" do
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
+
it "can access a user's picture data" do
|
101
|
+
result = @api.get_user_picture_data(KoalaTest.user2)
|
102
|
+
expect(result.key?("is_silhouette")).to be_truthy
|
103
|
+
end
|
104
|
+
|
100
105
|
it "can access connections from public Pages" do
|
101
106
|
result = @api.get_connections(KoalaTest.page, "photos")
|
102
107
|
expect(result).to be_a(Array)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: koala
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Koppel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -141,9 +141,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
141
141
|
version: '0'
|
142
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
|
-
- - "
|
144
|
+
- - ">="
|
145
145
|
- !ruby/object:Gem::Version
|
146
|
-
version:
|
146
|
+
version: '0'
|
147
147
|
requirements: []
|
148
148
|
rubyforge_project:
|
149
149
|
rubygems_version: 2.2.1
|