embedly 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ *embedly-0.3.3 (20 Feb 2011)
2
+ 20 Feb 2011: Bob Corsaro <bob@embed.ly>
3
+ Fixes namespace issue
4
+
1
5
  *embedly-0.3.0 (04 Feb 2011)
2
6
 
3
7
  04 Feb 2011: Bob Corsaro <bob@embed.ly>
@@ -12,7 +12,7 @@ To install the official latest stable version, please use rubygems.
12
12
 
13
13
  If you would like cutting edge, then you can clone and install HEAD.
14
14
 
15
- git clone git@github.com:embedly/embedly-ruby.git
15
+ git clone git://github.com/embedly/embedly-ruby.git
16
16
  cd embedly-ruby
17
17
  rake install
18
18
 
@@ -23,17 +23,17 @@ You can find rdocs at http://rubydoc.info/github/embedly/embedly-ruby/master/fra
23
23
  require 'embedly'
24
24
  require 'json'
25
25
 
26
- embedly_api = Embedly::API.new
26
+ embedly_api = Embedly::API.new :user_agent => 'Mozilla/5.0 (compatible; mytestapp/1.0; my@email.com)'
27
27
 
28
28
  # single url
29
- obj = embedly_api.oembed :url => 'http://blog.embed.ly'
29
+ obj = embedly_api.oembed :url => 'http://www.youtube.com/watch?v=sPbJ4Z5D-n4&feature=topvideos'
30
30
  puts obj[0].marshal_dump
31
31
  json_obj = JSON.pretty_generate(obj[0].marshal_dump)
32
32
  puts json_obj
33
33
 
34
34
  # multiple urls with opts
35
35
  objs = embedly_api.oembed(
36
- :urls => ['http://blog.embed.ly', 'http://blog.doki-pen.org'],
36
+ :urls => ['http://www.youtube.com/watch?v=sPbJ4Z5D-n4&feature=topvideos', 'http://twitpic.com/3yr7hk'],
37
37
  :maxWidth => 450,
38
38
  :wmode => 'transparent',
39
39
  :method => 'after'
@@ -42,7 +42,8 @@ You can find rdocs at http://rubydoc.info/github/embedly/embedly-ruby/master/fra
42
42
  puts json_obj
43
43
 
44
44
  # call pro with key (you'll need a real key)
45
- embedly_pro = Embedly::API.new :key => 'xxxxxxxxxxxxxxxxxxxxxxxxxx'
45
+ embedly_pro = Embedly::API.new :key => 'xxxxxxxxxxxxxxxxxxxxxxxxxx',
46
+ :user_agent => 'Mozilla/5.0 (compatible; mytestapp/1.0; my@email.com)'
46
47
  url = 'http://www.guardian.co.uk/media/2011/jan/21/andy-coulson-phone-hacking-statement'
47
48
  obj = embedly_pro.preview :url => url
48
49
  puts JSON.pretty_generate(obj[0].marshal_dump)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.3.3
@@ -74,7 +74,7 @@ Feature: OEmbed
74
74
  | url |
75
75
  | http://www.youtube.com/watch/is/a/bad/url |
76
76
  | http://www.scribd.com/doc/zfldsf/asdfkljlas/klajsdlfkasdf |
77
- | http://tweetphoto.com/alsdfldsf/asdfkljlas/klajsdlfkasdf |
77
+ | http://fav.me/alsfsdf |
78
78
 
79
79
 
80
80
  Scenario Outline: Attempt multi get 404 URLs
@@ -3,7 +3,6 @@ require 'json'
3
3
  require 'ostruct'
4
4
  require 'embedly/model'
5
5
 
6
- include ::Embedly
7
6
 
8
7
  # Performs api calls to embedly.
9
8
  #
@@ -36,6 +35,10 @@ include ::Embedly
36
35
  class Embedly::API
37
36
  attr_reader :key, :endpoint, :api_version, :user_agent
38
37
 
38
+ def logger *args
39
+ Embedly.logger *args
40
+ end
41
+
39
42
  # === Options
40
43
  #
41
44
  # [:+endpoint+] Hostname of embedly server. Defaults to api.embed.ly if no key is provided, pro.embed.ly if key is provided.
@@ -80,7 +83,7 @@ class Embedly::API
80
83
  params[:urls].reject!.with_index do |url, i|
81
84
  if url !~ services_regex
82
85
  rejects << [i,
83
- EmbedlyObject.new(
86
+ Embedly::EmbedlyObject.new(
84
87
  :type => 'error',
85
88
  :error_code => 401,
86
89
  :error_message => 'This service requires an Embedly Pro account'
@@ -108,7 +111,9 @@ class Embedly::API
108
111
  if response.code.to_i == 200
109
112
  logger.debug { response.body }
110
113
  # [].flatten is to be sure we have an array
111
- objs = [JSON.parse(response.body)].flatten.collect {|o| EmbedlyObject.new(o)}
114
+ objs = [JSON.parse(response.body)].flatten.collect do |o|
115
+ Embedly::EmbedlyObject.new(o)
116
+ end
112
117
  else
113
118
  logger.error { response.inspect }
114
119
  raise 'An unexpected error occurred'
@@ -22,7 +22,7 @@ class Embedly::EmbedlyObject < OpenStruct
22
22
  def marshal_dump
23
23
  o = @table.clone
24
24
  o.each do |k,v|
25
- if v.is_a?EmbedlyObject
25
+ if v.is_a?Embedly::EmbedlyObject
26
26
  o[k] = v.marshal_dump
27
27
  end
28
28
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 2
9
- version: 0.3.2
8
+ - 3
9
+ version: 0.3.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Bob Corsaro
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-02-14 00:00:00 -05:00
17
+ date: 2011-02-20 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency