flickr_oauth 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +14 -0
- data/flickr_oauth.gemspec +3 -1
- data/lib/flickr.rb +188 -1
- data/lib/flickr/client.rb +17 -46
- data/lib/flickr/client/authentication.rb +17 -0
- data/lib/flickr/client/connection.rb +44 -0
- data/lib/flickr/client/requests.rb +69 -0
- data/lib/flickr/client/upload.rb +22 -0
- data/lib/flickr/node.rb +2 -28
- data/lib/flickr_oauth/version.rb +1 -1
- data/spec/.DS_Store +0 -0
- data/spec/fixtures/.DS_Store +0 -0
- data/spec/fixtures/cassettes/.DS_Store +0 -0
- data/spec/fixtures/cassettes/flickr_reflection_getMethodInfo/_format_json.yml +133 -0
- data/spec/fixtures/cassettes/flickr_reflection_getMethodInfo/_format_rest.yml +133 -0
- data/spec/fixtures/cassettes/flickr_reflection_getMethods/.yml +65 -0
- data/spec/fixtures/cassettes/flickr_reflection_getMethods/_format_json.yml +65 -0
- data/spec/fixtures/cassettes/flickr_reflection_getMethods/_format_rest.yml +64 -0
- data/spec/fixtures/cassettes/{JSON_format/it_should_behave_like_Flickr_with_specified_format/Flickr/flickr_test_echo/with_oauth_token.yml → flickr_test_echo/_format_json.yml} +12 -12
- data/spec/fixtures/cassettes/{REST_format/it_should_behave_like_Flickr_with_specified_format/Flickr/flickr_test_echo/with_oauth_token.yml → flickr_test_echo/_format_rest.yml} +13 -13
- data/spec/fixtures/cassettes/flickr_upload.yml +1798 -0
- data/spec/fixtures/test.jpg +0 -0
- data/spec/fixtures/test_2.jpg +0 -0
- data/spec/flickr/reflection/getMethodInfo_spec.rb +73 -0
- data/spec/flickr/reflection/getMethods_spec.rb +53 -0
- data/spec/flickr/test/echo_spec.rb +51 -0
- data/spec/flickr/upload_spec.rb +33 -0
- data/spec/spec_helper.rb +4 -5
- metadata +70 -25
- data/spec/fixtures/cassettes/JSON_format/it_should_behave_like_Flickr_with_specified_format/Flickr/flickr_test_echo/no_oauth_token.yml +0 -40
- data/spec/fixtures/cassettes/REST_format/it_should_behave_like_Flickr_with_specified_format/Flickr/flickr_test_echo/no_oauth_token.yml +0 -39
- data/spec/json/flickr_spec.rb +0 -6
- data/spec/rest/flickr_spec.rb +0 -6
- data/spec/shared_examples.rb +0 -65
@@ -1,39 +0,0 @@
|
|
1
|
-
---
|
2
|
-
- !ruby/struct:VCR::HTTPInteraction
|
3
|
-
request: !ruby/struct:VCR::Request
|
4
|
-
method: :get
|
5
|
-
uri: http://api.flickr.com:80/services/rest?foo=bar&format=rest&method=flickr.test.echo
|
6
|
-
body:
|
7
|
-
headers:
|
8
|
-
authorization:
|
9
|
-
- OAuth oauth_consumer_key="", oauth_nonce="557fb7ff9b5b8d7b2c5dddfdba2c1dc3", oauth_signature="QlNe2R7Z0m6WvnB%2BnS38dsgMUVk%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1309463377", oauth_token="", oauth_version="1.0"
|
10
|
-
accept-encoding:
|
11
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
-
response: !ruby/struct:VCR::Response
|
13
|
-
status: !ruby/struct:VCR::ResponseStatus
|
14
|
-
code: 200
|
15
|
-
message: OK
|
16
|
-
headers:
|
17
|
-
date:
|
18
|
-
- Thu, 30 Jun 2011 19:49:38 GMT
|
19
|
-
p3p:
|
20
|
-
- policyref="http://p3p.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"
|
21
|
-
x-served-by:
|
22
|
-
- www133.flickr.mud.yahoo.com
|
23
|
-
cache-control:
|
24
|
-
- private
|
25
|
-
vary:
|
26
|
-
- Accept-Encoding
|
27
|
-
content-encoding:
|
28
|
-
- gzip
|
29
|
-
content-length:
|
30
|
-
- "136"
|
31
|
-
content-type:
|
32
|
-
- text/xml; charset=utf-8
|
33
|
-
body: !binary |
|
34
|
-
H4sIAAAAAAAAAy2MOw4CMQwFa3IKyxUUsEtHkWRFuaLhChbrgKV8UBJWcHuM
|
35
|
-
RPOaeTN2eqcIK9cmJTs8HkYEzreySL47fPWwPyFM3tjantA6dYeBJKI3G8u1
|
36
|
-
gj5ZtVG11NSY80pRFjhfZ7jwB7a/eVAD+YNQaqK+Qxg0OmjVmy/WdvqWhAAA
|
37
|
-
AA==
|
38
|
-
|
39
|
-
http_version: "1.1"
|
data/spec/json/flickr_spec.rb
DELETED
data/spec/rest/flickr_spec.rb
DELETED
data/spec/shared_examples.rb
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
shared_examples_for 'Flickr with specified format' do
|
2
|
-
describe Flickr do
|
3
|
-
context 'flickr.test.echo' do
|
4
|
-
describe 'no oauth token' do
|
5
|
-
use_vcr_cassette
|
6
|
-
|
7
|
-
let(:flickr) { Flickr.new(:format => format) }
|
8
|
-
it 'raises a Flickr::Error exception' do
|
9
|
-
expect { flickr.test.echo :foo => 'bar' }.to raise_exception(Flickr::Error, /Invalid API key/i)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
describe 'with oauth token' do
|
14
|
-
use_vcr_cassette
|
15
|
-
|
16
|
-
let(:flickr) { Flickr.new({:format => format}.merge(oauth_options)) }
|
17
|
-
it 'does not raise a Flickr::Error exception' do
|
18
|
-
expect { flickr.test.echo :foo => 'bar' }.to_not raise_error(Flickr::Error)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'responds with the original request parameters' do
|
22
|
-
response = flickr.test.echo({:foo => 'bar', :format => format}.merge(oauth_options))
|
23
|
-
if format == :json
|
24
|
-
response['method']['_content'].should == 'flickr.test.echo'
|
25
|
-
response['foo']['_content'].should == 'bar'
|
26
|
-
else
|
27
|
-
response['rsp']['method'].should == 'flickr.test.echo'
|
28
|
-
response['rsp']['foo'].should == 'bar'
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe :flickr do
|
36
|
-
context 'flickr.test.echo' do
|
37
|
-
describe 'no oauth token' do
|
38
|
-
use_vcr_cassette
|
39
|
-
|
40
|
-
it 'raises a Flickr::Error exception' do
|
41
|
-
expect { flickr.test.echo :foo => 'bar', :format => format }.to raise_exception(Flickr::Error, /Invalid API key/i)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe 'with oauth token' do
|
46
|
-
use_vcr_cassette
|
47
|
-
|
48
|
-
it 'does not raise a Flickr::Error exception' do
|
49
|
-
expect { flickr.test.echo oauth_options.reverse_merge(:foo => 'bar', :format => format, :enable_logging => true) }.to_not raise_error(Flickr::Error)
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'responds with the original request parameters' do
|
53
|
-
response = flickr.test.echo({:foo => 'bar', :format => format}.merge(oauth_options))
|
54
|
-
if format == :json
|
55
|
-
response['method']['_content'].should == 'flickr.test.echo'
|
56
|
-
response['foo']['_content'].should == 'bar'
|
57
|
-
else
|
58
|
-
response['rsp']['method'].should == 'flickr.test.echo'
|
59
|
-
response['rsp']['foo'].should == 'bar'
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|