embedly 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ *embedly-0.3.0 (04 Feb 2011)
2
+
3
+ 04 Feb 2011: Bob Corsaro <bob@embed.ly>
4
+ Services methods always return an array, even for a single URL
5
+
6
+ 04 Feb 2011: Bob Corsaro <bob@embed.ly>
7
+ URLs are checked against the services regex for non-Pro calls
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -4,7 +4,7 @@ $:.unshift(File.expand_path('../../lib', __FILE__))
4
4
 
5
5
  options = OpenStruct.new({
6
6
  :endpoint => nil,
7
- :key => ENV['EMBEDLY_KEY'],
7
+ :key => ENV['EMBEDLY_KEY'] == '' ? nil : ENV['EMBEDLY_KEY'],
8
8
  :verbose => false,
9
9
  :args => {}
10
10
  })
@@ -4,7 +4,7 @@ $:.unshift(File.expand_path('../../lib', __FILE__))
4
4
 
5
5
  options = OpenStruct.new({
6
6
  :endpoint => nil,
7
- :key => ENV['EMBEDLY_KEY'],
7
+ :key => ENV['EMBEDLY_KEY'] == '' ? nil : ENV['EMBEDLY_KEY'],
8
8
  :verbose => false,
9
9
  :args => {}
10
10
  })
@@ -4,7 +4,7 @@ $:.unshift(File.expand_path('../../lib', __FILE__))
4
4
 
5
5
  options = OpenStruct.new({
6
6
  :endpoint => nil,
7
- :key => ENV['EMBEDLY_KEY'],
7
+ :key => ENV['EMBEDLY_KEY'] == '' ? nil : ENV['EMBEDLY_KEY'],
8
8
  :verbose => false,
9
9
  :args => {}
10
10
  })
@@ -8,6 +8,17 @@ Feature: Objectify
8
8
  Given an embedly endpoint
9
9
  When objectify is called with the <url> URL
10
10
  Then the meta.description should start with <metadesc>
11
+ And objectify api_version is 1
12
+
13
+ Examples:
14
+ | url | metadesc |
15
+ | http://tweetphoto.com/14784358 | Plixi allows user to ins |
16
+
17
+ Scenario Outline: Get the meta description with pro
18
+ Given an embedly endpoint with key
19
+ When objectify is called with the <url> URL
20
+ Then the meta.description should start with <metadesc>
21
+ And objectify api_version is 2
11
22
 
12
23
  Examples:
13
24
  | url | metadesc |
@@ -38,6 +38,10 @@ Then /an? (\w+) error should get thrown/ do |error|
38
38
  @error.class.to_s.should == error
39
39
  end
40
40
 
41
+ Then /objectify api_version is (\d+)$/ do |version|
42
+ @api.api_version[:objectify].should == version
43
+ end
44
+
41
45
  Then /([^\s]+) should be (.+)$/ do |key, value|
42
46
  raise @error if @error
43
47
  logger = Embedly.logger('api_steps')
@@ -30,7 +30,7 @@ include ::Embedly
30
30
  # api_version hash. Here is an example.
31
31
  #
32
32
  # api = Embedly::API.new
33
- # api.api_version['new_method'] = 3
33
+ # api.api_version[:new_method] = 3
34
34
  # api.new_method :arg1 => '1', :arg2 => '2'
35
35
  #
36
36
  class Embedly::API
@@ -43,13 +43,14 @@ class Embedly::API
43
43
  # [:+user_agent+] Your User-Agent header. Defaults to Mozilla/5.0 (compatible; embedly-ruby/VERSION;)
44
44
  def initialize opts={}
45
45
  @key = opts[:key]
46
+ @api_version = Hash.new('1')
46
47
  if @key
47
48
  logger.debug('using pro')
48
49
  @endpoint = opts[:endpoint] || 'pro.embed.ly'
50
+ @api_version.merge!({:objectify => '2'})
49
51
  else
50
52
  @endpoint = opts[:endpoint] || 'api.embed.ly'
51
53
  end
52
- @api_version = Hash.new('1').merge!({'objectify' => '2'})
53
54
  @user_agent = opts[:user_agent] || "Mozilla/5.0 (compatible; embedly-ruby/#{Embedly::VERSION};)"
54
55
  end
55
56
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 0
9
- version: 0.3.0
8
+ - 1
9
+ version: 0.3.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Bob Corsaro
@@ -65,9 +65,11 @@ executables:
65
65
  extensions: []
66
66
 
67
67
  extra_rdoc_files:
68
+ - ChangeLog
68
69
  - README.rdoc
69
70
  files:
70
71
  - .rvmrc
72
+ - ChangeLog
71
73
  - MIT-LICENSE
72
74
  - README.rdoc
73
75
  - Rakefile