flickraw 0.9.3 → 0.9.4
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/README.rdoc +2 -0
- data/lib/flickraw.rb +1 -1
- data/lib/flickraw/oauth.rb +11 -10
- metadata +17 -26
data/README.rdoc
CHANGED
@@ -9,6 +9,8 @@ The github repository: http://github.com/hanklords/flickraw
|
|
9
9
|
|
10
10
|
= Installation
|
11
11
|
Type this in a console (you might need to be superuser)
|
12
|
+
|
13
|
+
gem install json (This is only necessary on ruby 1.8)
|
12
14
|
gem install flickraw
|
13
15
|
|
14
16
|
This will recreate the documentation by fetching the methods descriptions from flickr and then virtually plugging them in standard rdoc documentation.
|
data/lib/flickraw.rb
CHANGED
data/lib/flickraw/oauth.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'openssl'
|
2
|
-
require 'net/
|
2
|
+
require 'net/https'
|
3
3
|
|
4
4
|
module FlickRaw
|
5
5
|
class OAuthClient
|
@@ -88,12 +88,13 @@ module FlickRaw
|
|
88
88
|
|
89
89
|
request.body = ''
|
90
90
|
params.each { |k, v|
|
91
|
-
if v.
|
92
|
-
basename = File.basename(v.path).to_s
|
91
|
+
if v.respond_to? :read
|
92
|
+
basename = File.basename(v.path).to_s if v.respond_to? :path
|
93
|
+
basename ||= File.basename(v.base_uri).to_s if v.respond_to? :base_uri
|
94
|
+
basename ||= "unknown"
|
93
95
|
basename = basename.encode("utf-8").force_encoding("ascii-8bit") if RUBY_VERSION >= "1.9"
|
94
|
-
filename = basename
|
95
96
|
request.body << "--#{boundary}\r\n" <<
|
96
|
-
"Content-Disposition: form-data; name=\"#{k}\"; filename=\"#{
|
97
|
+
"Content-Disposition: form-data; name=\"#{k}\"; filename=\"#{basename}\"\r\n" <<
|
97
98
|
"Content-Transfer-Encoding: binary\r\n" <<
|
98
99
|
"Content-Type: image/jpeg\r\n\r\n" <<
|
99
100
|
v.read << "\r\n"
|
@@ -128,18 +129,18 @@ module FlickRaw
|
|
128
129
|
default_oauth_params[:oauth_consumer_key] = @consumer_key
|
129
130
|
default_oauth_params[:oauth_signature_method] = "PLAINTEXT" if url.scheme == 'https'
|
130
131
|
oauth_params = default_oauth_params.merge(oauth_params)
|
131
|
-
params_signed = params.reject {|k,v| v.
|
132
|
+
params_signed = params.reject {|k,v| v.respond_to? :read}.merge(oauth_params)
|
132
133
|
oauth_params[:oauth_signature] = sign(:post, url, params_signed, token_secret)
|
133
134
|
|
134
|
-
|
135
|
-
|
136
|
-
|
135
|
+
http = Net::HTTP.new(url.host, url.port, @proxy.host, @proxy.port, @proxy.user, @proxy.password)
|
136
|
+
http.use_ssl = (url.scheme == 'https')
|
137
|
+
r = http.start {|agent|
|
137
138
|
request = Net::HTTP::Post.new(url.path)
|
138
139
|
request['User-Agent'] = @user_agent if @user_agent
|
139
140
|
request['Authorization'] = OAuthClient.authorization_header(url, oauth_params)
|
140
141
|
|
141
142
|
yield request
|
142
|
-
|
143
|
+
agent.request(request)
|
143
144
|
}
|
144
145
|
|
145
146
|
raise FailedResponse.new(r.body) if r.is_a? Net::HTTPClientError
|
metadata
CHANGED
@@ -1,27 +1,22 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: flickraw
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.4
|
4
5
|
prerelease:
|
5
|
-
version: 0.9.3
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Mael Clerambault
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
date: 2011-10-09 00:00:00 Z
|
12
|
+
date: 2011-11-09 00:00:00.000000000 Z
|
14
13
|
dependencies: []
|
15
|
-
|
16
14
|
description:
|
17
15
|
email: maelclerambault@yahoo.fr
|
18
16
|
executables: []
|
19
|
-
|
20
17
|
extensions: []
|
21
|
-
|
22
18
|
extra_rdoc_files: []
|
23
|
-
|
24
|
-
files:
|
19
|
+
files:
|
25
20
|
- examples/auth.rb
|
26
21
|
- examples/interestingness.rb
|
27
22
|
- examples/search.rb
|
@@ -41,30 +36,26 @@ files:
|
|
41
36
|
- rakefile
|
42
37
|
homepage: http://hanklords.github.com/flickraw/
|
43
38
|
licenses: []
|
44
|
-
|
45
39
|
post_install_message:
|
46
40
|
rdoc_options: []
|
47
|
-
|
48
|
-
require_paths:
|
41
|
+
require_paths:
|
49
42
|
- lib
|
50
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
44
|
none: false
|
52
|
-
requirements:
|
53
|
-
- -
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version:
|
56
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
50
|
none: false
|
58
|
-
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version:
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
62
55
|
requirements: []
|
63
|
-
|
64
56
|
rubyforge_project:
|
65
57
|
rubygems_version: 1.8.10
|
66
58
|
signing_key:
|
67
59
|
specification_version: 3
|
68
60
|
summary: Flickr library with a syntax close to the syntax described on http://www.flickr.com/services/api
|
69
61
|
test_files: []
|
70
|
-
|