embedly 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/embedly.gemspec +94 -0
- data/lib/embedly/api.rb +12 -2
- metadata +144 -99
- data/.rvmrc +0 -1
data/README.rdoc
CHANGED
@@ -73,7 +73,7 @@ You can configure some parameters in the api:
|
|
73
73
|
== Testing
|
74
74
|
|
75
75
|
gem install jeweler
|
76
|
-
rake
|
76
|
+
rake spec
|
77
77
|
rake features # if it complains of missing deps install them
|
78
78
|
|
79
79
|
Some tests will fail due to missing api key. Set the EMBEDLY_KEY environmental
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.7.0
|
data/embedly.gemspec
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "embedly"
|
8
|
+
s.version = "1.7.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Bob Corsaro", "Felipe Elias Philipp", "Russ Bradberry", "Arun Thampi"]
|
12
|
+
s.date = "2013-06-17"
|
13
|
+
s.description = "Ruby Embedly client library"
|
14
|
+
s.email = "bob@embed.ly"
|
15
|
+
s.executables = ["embedly_extract", "embedly_objectify", "embedly_oembed", "embedly_preview"]
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"ChangeLog",
|
18
|
+
"README.rdoc"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
"ChangeLog",
|
22
|
+
"Gemfile",
|
23
|
+
"MIT-LICENSE",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"bin/embedly_extract",
|
28
|
+
"bin/embedly_objectify",
|
29
|
+
"bin/embedly_oembed",
|
30
|
+
"bin/embedly_preview",
|
31
|
+
"cucumber.yml",
|
32
|
+
"embedly.gemspec",
|
33
|
+
"features/command_line.feature",
|
34
|
+
"features/objectify.feature",
|
35
|
+
"features/oembed.feature",
|
36
|
+
"features/steps/api_steps.rb",
|
37
|
+
"features/steps/env.rb",
|
38
|
+
"lib/embedly.rb",
|
39
|
+
"lib/embedly/api.rb",
|
40
|
+
"lib/embedly/command_line.rb",
|
41
|
+
"lib/embedly/configuration.rb",
|
42
|
+
"lib/embedly/exceptions.rb",
|
43
|
+
"lib/embedly/model.rb",
|
44
|
+
"spec/embedly/api_spec.rb",
|
45
|
+
"spec/embedly/command_line_spec.rb",
|
46
|
+
"spec/embedly/configuration_spec.rb",
|
47
|
+
"spec/spec_helper.rb"
|
48
|
+
]
|
49
|
+
s.homepage = "http://github.com/embedly/embedly-ruby"
|
50
|
+
s.licenses = ["MIT"]
|
51
|
+
s.require_paths = ["lib"]
|
52
|
+
s.rubygems_version = "1.8.25"
|
53
|
+
s.summary = "Ruby Embedly client library"
|
54
|
+
|
55
|
+
if s.respond_to? :specification_version then
|
56
|
+
s.specification_version = 3
|
57
|
+
|
58
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
59
|
+
s.add_runtime_dependency(%q<querystring>, [">= 0"])
|
60
|
+
s.add_runtime_dependency(%q<oauth>, [">= 0"])
|
61
|
+
s.add_runtime_dependency(%q<json>, [">= 0"])
|
62
|
+
s.add_runtime_dependency(%q<typhoeus>, [">= 0"])
|
63
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
64
|
+
s.add_development_dependency(%q<cucumber>, [">= 0"])
|
65
|
+
s.add_development_dependency(%q<rake>, [">= 0"])
|
66
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
67
|
+
s.add_development_dependency(%q<yard>, [">= 0"])
|
68
|
+
s.add_development_dependency(%q<aruba>, [">= 0"])
|
69
|
+
else
|
70
|
+
s.add_dependency(%q<querystring>, [">= 0"])
|
71
|
+
s.add_dependency(%q<oauth>, [">= 0"])
|
72
|
+
s.add_dependency(%q<json>, [">= 0"])
|
73
|
+
s.add_dependency(%q<typhoeus>, [">= 0"])
|
74
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
75
|
+
s.add_dependency(%q<cucumber>, [">= 0"])
|
76
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
77
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
78
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
79
|
+
s.add_dependency(%q<aruba>, [">= 0"])
|
80
|
+
end
|
81
|
+
else
|
82
|
+
s.add_dependency(%q<querystring>, [">= 0"])
|
83
|
+
s.add_dependency(%q<oauth>, [">= 0"])
|
84
|
+
s.add_dependency(%q<json>, [">= 0"])
|
85
|
+
s.add_dependency(%q<typhoeus>, [">= 0"])
|
86
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
87
|
+
s.add_dependency(%q<cucumber>, [">= 0"])
|
88
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
89
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
90
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
91
|
+
s.add_dependency(%q<aruba>, [">= 0"])
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
data/lib/embedly/api.rb
CHANGED
@@ -42,7 +42,7 @@ end
|
|
42
42
|
# api.new_method :arg1 => '1', :arg2 => '2'
|
43
43
|
#
|
44
44
|
class Embedly::API
|
45
|
-
attr_reader :key, :hostname, :api_version, :headers, :secret
|
45
|
+
attr_reader :key, :hostname, :api_version, :headers, :secret, :proxy
|
46
46
|
|
47
47
|
# === Options
|
48
48
|
#
|
@@ -52,6 +52,7 @@ class Embedly::API
|
|
52
52
|
# [:+user_agent+] Your User-Agent header. Defaults to Mozilla/5.0 (compatible; embedly-ruby/VERSION;)
|
53
53
|
# [:+timeout+] Request timeout (in seconds). Defaults to 180 seconds or 3 minutes
|
54
54
|
# [:+headers+] Additional headers to send with requests.
|
55
|
+
# [:+proxy+] Proxy settings in format {:host => '', :port => '', :user => '', :password => ''}
|
55
56
|
def initialize opts={}
|
56
57
|
@endpoints = [:oembed, :objectify, :preview, :extract]
|
57
58
|
@key = opts[:key]
|
@@ -63,9 +64,11 @@ class Embedly::API
|
|
63
64
|
@headers = {
|
64
65
|
'User-Agent' => opts[:user_agent] || "Mozilla/5.0 (compatible; embedly-ruby/#{Embedly::VERSION};)"
|
65
66
|
}.merge(opts[:headers]||{})
|
67
|
+
@proxy = opts[:proxy]
|
66
68
|
end
|
67
69
|
|
68
70
|
def _do_typhoeus_call path
|
71
|
+
logger.debug { 'using Typhoeus HTTP Client' }
|
69
72
|
scheme, host, port = uri_parse hostname
|
70
73
|
url = "#{scheme}://#{hostname}:#{port}#{path}"
|
71
74
|
logger.debug { "calling #{site}#{path} with headers #{headers} using Typhoeus" }
|
@@ -73,9 +76,16 @@ class Embedly::API
|
|
73
76
|
end
|
74
77
|
|
75
78
|
def _do_basic_call path
|
79
|
+
logger.debug { 'using Net:HTTP client' }
|
76
80
|
scheme, host, port = uri_parse hostname
|
77
81
|
logger.debug { "calling #{site}#{path} with headers #{headers} using Net::HTTP" }
|
78
|
-
|
82
|
+
http_class = if proxy
|
83
|
+
logger.debug { 'using Net::HTTP::Proxy' }
|
84
|
+
http_class = Net::HTTP::Proxy(proxy[:host], proxy[:port], proxy[:user], proxy[:password])
|
85
|
+
else
|
86
|
+
Net::HTTP
|
87
|
+
end
|
88
|
+
http_class.start(host, port) do |http|
|
79
89
|
http.use_ssl = (scheme == 'https')
|
80
90
|
http.read_timeout = @timeout
|
81
91
|
http.get(path, headers)
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: embedly
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.7.0
|
4
5
|
prerelease:
|
5
|
-
version: 1.6.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Bob Corsaro
|
9
9
|
- Felipe Elias Philipp
|
10
10
|
- Russ Bradberry
|
@@ -12,133 +12,180 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
- !ruby/object:Gem::Dependency
|
15
|
+
date: 2013-06-17 00:00:00.000000000 Z
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
19
18
|
name: querystring
|
20
|
-
requirement:
|
19
|
+
requirement: !ruby/object:Gem::Requirement
|
21
20
|
none: false
|
22
|
-
requirements:
|
23
|
-
- -
|
24
|
-
- !ruby/object:Gem::Version
|
25
|
-
version:
|
21
|
+
requirements:
|
22
|
+
- - ! '>='
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '0'
|
26
25
|
type: :runtime
|
27
26
|
prerelease: false
|
28
|
-
version_requirements:
|
29
|
-
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
30
34
|
name: oauth
|
31
|
-
requirement:
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
32
36
|
none: false
|
33
|
-
requirements:
|
34
|
-
- -
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version:
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
37
41
|
type: :runtime
|
38
42
|
prerelease: false
|
39
|
-
version_requirements:
|
40
|
-
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
- !ruby/object:Gem::Dependency
|
41
50
|
name: json
|
42
|
-
requirement:
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
43
52
|
none: false
|
44
|
-
requirements:
|
45
|
-
- -
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version:
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
48
57
|
type: :runtime
|
49
58
|
prerelease: false
|
50
|
-
version_requirements:
|
51
|
-
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ! '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
- !ruby/object:Gem::Dependency
|
52
66
|
name: typhoeus
|
53
|
-
requirement:
|
67
|
+
requirement: !ruby/object:Gem::Requirement
|
54
68
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
version:
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
59
73
|
type: :runtime
|
60
74
|
prerelease: false
|
61
|
-
version_requirements:
|
62
|
-
|
75
|
+
version_requirements: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
- !ruby/object:Gem::Dependency
|
63
82
|
name: jeweler
|
64
|
-
requirement:
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
65
84
|
none: false
|
66
|
-
requirements:
|
67
|
-
- -
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version:
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
70
89
|
type: :development
|
71
90
|
prerelease: false
|
72
|
-
version_requirements:
|
73
|
-
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
74
98
|
name: cucumber
|
75
|
-
requirement:
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
76
100
|
none: false
|
77
|
-
requirements:
|
78
|
-
- -
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
version:
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
81
105
|
type: :development
|
82
106
|
prerelease: false
|
83
|
-
version_requirements:
|
84
|
-
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ! '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
- !ruby/object:Gem::Dependency
|
85
114
|
name: rake
|
86
|
-
requirement:
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
87
116
|
none: false
|
88
|
-
requirements:
|
89
|
-
- -
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
version:
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
92
121
|
type: :development
|
93
122
|
prerelease: false
|
94
|
-
version_requirements:
|
95
|
-
|
123
|
+
version_requirements: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ! '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
- !ruby/object:Gem::Dependency
|
96
130
|
name: rspec
|
97
|
-
requirement:
|
131
|
+
requirement: !ruby/object:Gem::Requirement
|
98
132
|
none: false
|
99
|
-
requirements:
|
100
|
-
- -
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version:
|
133
|
+
requirements:
|
134
|
+
- - ! '>='
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
103
137
|
type: :development
|
104
138
|
prerelease: false
|
105
|
-
version_requirements:
|
106
|
-
|
139
|
+
version_requirements: !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
141
|
+
requirements:
|
142
|
+
- - ! '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
- !ruby/object:Gem::Dependency
|
107
146
|
name: yard
|
108
|
-
requirement:
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
109
148
|
none: false
|
110
|
-
requirements:
|
111
|
-
- -
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
version:
|
149
|
+
requirements:
|
150
|
+
- - ! '>='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
114
153
|
type: :development
|
115
154
|
prerelease: false
|
116
|
-
version_requirements:
|
117
|
-
|
155
|
+
version_requirements: !ruby/object:Gem::Requirement
|
156
|
+
none: false
|
157
|
+
requirements:
|
158
|
+
- - ! '>='
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
- !ruby/object:Gem::Dependency
|
118
162
|
name: aruba
|
119
|
-
requirement:
|
163
|
+
requirement: !ruby/object:Gem::Requirement
|
120
164
|
none: false
|
121
|
-
requirements:
|
122
|
-
- -
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version:
|
165
|
+
requirements:
|
166
|
+
- - ! '>='
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
125
169
|
type: :development
|
126
170
|
prerelease: false
|
127
|
-
version_requirements:
|
171
|
+
version_requirements: !ruby/object:Gem::Requirement
|
172
|
+
none: false
|
173
|
+
requirements:
|
174
|
+
- - ! '>='
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: '0'
|
128
177
|
description: Ruby Embedly client library
|
129
178
|
email: bob@embed.ly
|
130
|
-
executables:
|
179
|
+
executables:
|
131
180
|
- embedly_extract
|
132
181
|
- embedly_objectify
|
133
182
|
- embedly_oembed
|
134
183
|
- embedly_preview
|
135
184
|
extensions: []
|
136
|
-
|
137
|
-
extra_rdoc_files:
|
185
|
+
extra_rdoc_files:
|
138
186
|
- ChangeLog
|
139
187
|
- README.rdoc
|
140
|
-
files:
|
141
|
-
- .rvmrc
|
188
|
+
files:
|
142
189
|
- ChangeLog
|
143
190
|
- Gemfile
|
144
191
|
- MIT-LICENSE
|
@@ -150,6 +197,7 @@ files:
|
|
150
197
|
- bin/embedly_oembed
|
151
198
|
- bin/embedly_preview
|
152
199
|
- cucumber.yml
|
200
|
+
- embedly.gemspec
|
153
201
|
- features/command_line.feature
|
154
202
|
- features/objectify.feature
|
155
203
|
- features/oembed.feature
|
@@ -166,34 +214,31 @@ files:
|
|
166
214
|
- spec/embedly/configuration_spec.rb
|
167
215
|
- spec/spec_helper.rb
|
168
216
|
homepage: http://github.com/embedly/embedly-ruby
|
169
|
-
licenses:
|
217
|
+
licenses:
|
170
218
|
- MIT
|
171
219
|
post_install_message:
|
172
220
|
rdoc_options: []
|
173
|
-
|
174
|
-
require_paths:
|
221
|
+
require_paths:
|
175
222
|
- lib
|
176
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
223
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
177
224
|
none: false
|
178
|
-
requirements:
|
179
|
-
- -
|
180
|
-
- !ruby/object:Gem::Version
|
181
|
-
|
182
|
-
segments:
|
225
|
+
requirements:
|
226
|
+
- - ! '>='
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: '0'
|
229
|
+
segments:
|
183
230
|
- 0
|
184
|
-
|
185
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
231
|
+
hash: 3096101211403107317
|
232
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
233
|
none: false
|
187
|
-
requirements:
|
188
|
-
- -
|
189
|
-
- !ruby/object:Gem::Version
|
190
|
-
version:
|
234
|
+
requirements:
|
235
|
+
- - ! '>='
|
236
|
+
- !ruby/object:Gem::Version
|
237
|
+
version: '0'
|
191
238
|
requirements: []
|
192
|
-
|
193
239
|
rubyforge_project:
|
194
240
|
rubygems_version: 1.8.25
|
195
241
|
signing_key:
|
196
242
|
specification_version: 3
|
197
243
|
summary: Ruby Embedly client library
|
198
244
|
test_files: []
|
199
|
-
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm use 1.9.2@embedly-ruby
|