embedly / embedly-ruby Goto Github PK
View Code? Open in Web Editor NEWRuby Embedly Client
Home Page: http://api.embed.ly/docs
License: MIT License
Ruby Embedly Client
Home Page: http://api.embed.ly/docs
License: MIT License
Services like yfrog and lockerz are no longer online.
The feature tests rely on them, so they break.
The current output of the feature tests:
Using the default profile...
Feature: Command line runner
As an embedly user
I want to call the the embedly api via command line
Scenario: Run oembed command # features/command_line.feature:5
When I run `embedly_oembed http://lockerz.com/s/136425091` # aruba-0.14.2/lib/aruba/cucumber/command.rb:13
Then the output should contain: # aruba-0.14.2/lib/aruba/cucumber/command.rb:205
"""
"provider_url": "http://pics.lockerz.com"
"""
expected "" to string includes: "\"provider_url\": \"http://pics.lockerz.com\"" (RSpec::Expectations::ExpectationNotMetError)
features/command_line.feature:7:in `Then the output should contain:'
Scenario: Run oembed command verbosely # features/command_line.feature:12
When I run `embedly_oembed -v http://lockerz.com/s/136425091` # aruba-0.14.2/lib/aruba/cucumber/command.rb:13
Then the output should contain: # aruba-0.14.2/lib/aruba/cucumber/command.rb:205
"""
DEBUG -- : calling http://api.embed.ly/1/oembed
"""
Feature: Objectify
As an embedly user
I want to call the the embedly api
Because I want to objectify a url
Scenario Outline: Get the meta description with pro # features/objectify.feature:7
Given an embedly api with key # features/objectify.feature:8
When objectify is called with the <url> URL # features/objectify.feature:9
Then the meta.description should start with <metadesc> # features/objectify.feature:10
And objectify api_version is 2 # features/objectify.feature:11
Examples:
| url | metadesc |
| http://lockerz.com/s/136425091 | Collect the things you love. Earn |
Bad Response : #<Typhoeus::Response:0x007f986b27a848 @options={:httpauth_avail=>0, :total_time=>0.205397, :starttransfer_time=>0.204862, :appconnect_time=>0.0, :pretransfer_time=>0.100858, :connect_time=>0.100775, :namelookup_time=>0.015417, :redirect_time=>0.0, :effective_url=>"http://api.embed.ly/2/objectify?urls=http%3A%2F%2Flockerz.com%2Fs%2F136425091&key=5e187cd8a84a4b73bd9ca1971c4db9cd", :primary_ip=>"23.23.102.4", :response_code=>403, :request_size=>204, :redirect_count=>0, :return_code=>:ok, :response_headers=>"HTTP/1.1 403 Forbidden\r\nAccess-Control-Allow-Methods: GET, OPTIONS\r\nAccess-Control-Allow-Origin: *\r\nAccess-Control-Max-Age: 86400\r\nContent-Type: text/html; charset=UTF-8\r\nDate: Tue, 13 Sep 2016 07:44:39 GMT\r\nServer: TornadoServer/4.4.1\r\nX-Embedly-From-Cache: \r\nX-Embedly-Host: unearth24\r\nContent-Length: 95\r\nConnection: keep-alive\r\n\r\n", :response_body=>"{\"error_code\": 403, \"error_message\": \"objectify_two feature is not supported\", \"type\": \"error\"}", :debug_info=>#<Ethon::Easy::DebugInfo:0x007f986b27bf18 @messages=[]>}, @request=#<Typhoeus::Request:0x007f986b198b50 @base_url="http://api.embed.ly/2/objectify?urls=http%3A%2F%2Flockerz.com%2Fs%2F136425091&key=5e187cd8a84a4b73bd9ca1971c4db9cd", @original_options={:headers=>{"User-Agent"=>"Mozilla/5.0 (compatible; embedly-ruby/1.9.1;)"}, :timeout=>180000, :method=>:get}, @options={:headers=>{"User-Agent"=>"Mozilla/5.0 (compatible; embedly-ruby/1.9.1;)", "Expect"=>""}, :timeout=>180000, :method=>:get, :maxredirs=>50}, @on_headers=[], @response=#<Typhoeus::Response:0x007f986b27a848 ...>, @on_complete=[], @on_failure=[]>> for path: "/2/objectify?urls=http%3A%2F%2Flockerz.com%2Fs%2F136425091&key=5e187cd8a84a4b73bd9ca1971c4db9cd" (Embedly::BadResponseException)
./lib/embedly/api.rb:150:in `apicall'
./lib/embedly/api.rb:199:in `method_missing'
./features/steps/api_steps.rb:31:in `/([^\s]+) should start with ([^\s]+)/'
features/objectify.feature:15:in `Then the meta.description should start with Collect the things you love. Earn'
features/objectify.feature:10:in `Then the meta.description should start with <metadesc>'
Feature: OEmbed
As an embedly user
I want to call the the embedly api
Because I want and oembed for a specific url
Scenario Outline: Get the provider_url # features/oembed.feature:7
Given an embedly api with key # features/oembed.feature:8
When oembed is called with the <url> URL # features/oembed.feature:9
Then the provider_url should be <provider_url> # features/oembed.feature:10
Examples:
| url | provider_url |
|DEPRECATION: Using `should` from rspec-expectations' old `:should` syntax without explicitly enabling the syntax is deprecated. Use the new `:expect` syntax or explicitly enable `:should` with `config.expect_with(:rspec) { |c| c.syntax = :should }` instead. Called from /Users/martijn/.gem/ruby/2.3.1/gems/embedly-1.9.1/features/steps/api_steps.rb:49:in `block in <top (required)>'.
http://www.scribd.com/doc/13994900/Easter | http://www.scribd.com/ |
expected: "http://www.scribd.com/"
got: "https://www.scribd.com" (using ==) (RSpec::Expectations::ExpectationNotMetError)
./features/steps/api_steps.rb:49:in `/([^\s]+) should be (.+)$/'
features/oembed.feature:14:in `Then the provider_url should be http://www.scribd.com/'
features/oembed.feature:10:in `Then the provider_url should be <provider_url>'
| http://www.scribd.com/doc/28452730/Easter-Cards | http://www.scribd.com/ |
expected: "http://www.scribd.com/"
got: "" (using ==) (RSpec::Expectations::ExpectationNotMetError)
./features/steps/api_steps.rb:49:in `/([^\s]+) should be (.+)$/'
features/oembed.feature:15:in `Then the provider_url should be http://www.scribd.com/'
features/oembed.feature:10:in `Then the provider_url should be <provider_url>'
| http://www.youtube.com/watch?v=Zk7dDekYej0 | http://www.youtube.com/ |
expected: "http://www.youtube.com/"
got: "https://www.youtube.com/" (using ==) (RSpec::Expectations::ExpectationNotMetError)
./features/steps/api_steps.rb:49:in `/([^\s]+) should be (.+)$/'
features/oembed.feature:16:in `Then the provider_url should be http://www.youtube.com/'
features/oembed.feature:10:in `Then the provider_url should be <provider_url>'
| http://yfrog.com/h7qqespj | http://yfrog.com |
expected: "http://yfrog.com"
got: "https://imageshack.com" (using ==) (RSpec::Expectations::ExpectationNotMetError)
./features/steps/api_steps.rb:49:in `/([^\s]+) should be (.+)$/'
features/oembed.feature:17:in `Then the provider_url should be http://yfrog.com'
features/oembed.feature:10:in `Then the provider_url should be <provider_url>'
| http://blog.embed.ly/bob | http://tumblr.com |
expected: "http://tumblr.com"
got: "" (using ==) (RSpec::Expectations::ExpectationNotMetError)
./features/steps/api_steps.rb:49:in `/([^\s]+) should be (.+)$/'
features/oembed.feature:18:in `Then the provider_url should be http://tumblr.com'
features/oembed.feature:10:in `Then the provider_url should be <provider_url>'
Scenario Outline: Get the types # features/oembed.feature:21
Given an embedly api with key # features/oembed.feature:22
When oembed is called with the <url> URL # features/oembed.feature:23
Then the type should be <type> # features/oembed.feature:24
Examples:
| url | type |
| http://www.scribd.com/doc/13994900/Easter | rich |
expected: "rich"
got: "link" (using ==) (RSpec::Expectations::ExpectationNotMetError)
./features/steps/api_steps.rb:49:in `/([^\s]+) should be (.+)$/'
features/oembed.feature:28:in `Then the type should be rich'
features/oembed.feature:24:in `Then the type should be <type>'
| http://www.scribd.com/doc/28452730/Easter-Cards | rich |
expected: "rich"
got: "error" (using ==) (RSpec::Expectations::ExpectationNotMetError)
./features/steps/api_steps.rb:49:in `/([^\s]+) should be (.+)$/'
features/oembed.feature:29:in `Then the type should be rich'
features/oembed.feature:24:in `Then the type should be <type>'
| http://www.youtube.com/watch?v=Zk7dDekYej0 | video |
| http://yfrog.com/h7qqespj | photo |
expected: "photo"
got: "link" (using ==) (RSpec::Expectations::ExpectationNotMetError)
./features/steps/api_steps.rb:49:in `/([^\s]+) should be (.+)$/'
features/oembed.feature:31:in `Then the type should be photo'
features/oembed.feature:24:in `Then the type should be <type>'
Scenario Outline: Get the provider_url with force flag # features/oembed.feature:34
Given an embedly api with key # features/oembed.feature:35
When oembed is called with the <url> URL and force flag # features/oembed.feature:36
Then the provider_url should be <provider_url> # features/oembed.feature:37
Examples:
| url | provider_url |
| http://www.youtube.com/watch?v=Zk7dDekYej0 | http://www.youtube.com/ |
expected: "http://www.youtube.com/"
got: "https://www.youtube.com/" (using ==) (RSpec::Expectations::ExpectationNotMetError)
./features/steps/api_steps.rb:49:in `/([^\s]+) should be (.+)$/'
features/oembed.feature:41:in `Then the provider_url should be http://www.youtube.com/'
features/oembed.feature:37:in `Then the provider_url should be <provider_url>'
Scenario Outline: Get multiple provider_urls # features/oembed.feature:44
Given an embedly api with key # features/oembed.feature:45
When oembed is called with the <urls> URLs # features/oembed.feature:46
Then provider_url should be <provider_urls> # features/oembed.feature:47
Examples:
| urls | provider_urls |
| http://www.scribd.com/doc/13994900/Easter,http://www.scribd.com/doc/28452730/Easter-Cards | http://www.scribd.com/,http://www.scribd.com/ |
expected: "http://www.scribd.com/,http://www.scribd.com/"
got: "https://www.scribd.com," (using ==) (RSpec::Expectations::ExpectationNotMetError)
./features/steps/api_steps.rb:49:in `/([^\s]+) should be (.+)$/'
features/oembed.feature:51:in `Then provider_url should be http://www.scribd.com/,http://www.scribd.com/'
features/oembed.feature:47:in `Then provider_url should be <provider_urls>'
| http://www.youtube.com/watch?v=Zk7dDekYej0,http://yfrog.com/h7qqespj | http://www.youtube.com/,http://yfrog.com |
expected: "http://www.youtube.com/,http://yfrog.com"
got: "https://www.youtube.com/,https://imageshack.com" (using ==) (RSpec::Expectations::ExpectationNotMetError)
./features/steps/api_steps.rb:49:in `/([^\s]+) should be (.+)$/'
features/oembed.feature:52:in `Then provider_url should be http://www.youtube.com/,http://yfrog.com'
features/oembed.feature:47:in `Then provider_url should be <provider_urls>'
Scenario Outline: Attempt to get 404 URL # features/oembed.feature:55
Given an embedly api with key # features/oembed.feature:56
When oembed is called with the <url> URL # features/oembed.feature:57
Then type should be error # features/oembed.feature:58
And error_code should be 404 # features/oembed.feature:59
And type should be error # features/oembed.feature:60
Examples:
| url |
| http://www.youtube.com/watch/is/a/bad/url |
| http://fav.me/alsfsdf |
Scenario Outline: Attempt multi get 404 URLs # features/oembed.feature:68
Given an embedly api with key # features/oembed.feature:69
When oembed is called with the <urls> URLs # features/oembed.feature:70
Then error_code should be <errcode> # features/oembed.feature:71
And type should be <types> # features/oembed.feature:72
Examples:
| urls | errcode | types |
| http://www.youtube.com/watch/a/bassd/url,http://www.youtube.com/watch/ldf/asdlfj | 404,404 | error,error |
| http://www.youtube.com/watch/zzzzasdf/kl,http://yfrog.com/h7qqespj | 404, | error,photo |
expected: "error,photo"
got: "error,link" (using ==) (RSpec::Expectations::ExpectationNotMetError)
./features/steps/api_steps.rb:49:in `/([^\s]+) should be (.+)$/'
features/oembed.feature:77:in `And type should be error,photo'
features/oembed.feature:72:in `And type should be <types>'
| http://yfrog.com/h7qqespj,http://www.youtube.com/watch/asdfasdf/asdf | ,404 | photo,error |
expected: "photo,error"
got: "link,error" (using ==) (RSpec::Expectations::ExpectationNotMetError)
./features/steps/api_steps.rb:49:in `/([^\s]+) should be (.+)$/'
features/oembed.feature:78:in `And type should be photo,error'
features/oembed.feature:72:in `And type should be <types>'
Scenario Outline: Attempt to get 414 URL # features/oembed.feature:80
Given an embedly api with key # features/oembed.feature:81
When oembed is called with the <url> URL # features/oembed.feature:82
Then type should be error # features/oembed.feature:83
And error_code should be 414 # features/oembed.feature:84
And type should be error # features/oembed.feature:85
Examples:
| url |
| http://www.youtube.com/watch/is/a/bad/url/because/it/is/longer/than/2048/characters/this/is/much/too/long/for/a/url/and/shouldnt/even/be/sent/to/the/server/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
Failing Scenarios:
cucumber features/command_line.feature:5 # Scenario: Run oembed command
cucumber features/objectify.feature:15 # Scenario Outline: Get the meta description with pro, Examples (#1)
cucumber features/oembed.feature:14 # Scenario Outline: Get the provider_url, Examples (#1)
cucumber features/oembed.feature:15 # Scenario Outline: Get the provider_url, Examples (#2)
cucumber features/oembed.feature:16 # Scenario Outline: Get the provider_url, Examples (#3)
cucumber features/oembed.feature:17 # Scenario Outline: Get the provider_url, Examples (#4)
cucumber features/oembed.feature:18 # Scenario Outline: Get the provider_url, Examples (#5)
cucumber features/oembed.feature:28 # Scenario Outline: Get the types, Examples (#1)
cucumber features/oembed.feature:29 # Scenario Outline: Get the types, Examples (#2)
cucumber features/oembed.feature:31 # Scenario Outline: Get the types, Examples (#4)
cucumber features/oembed.feature:41 # Scenario Outline: Get the provider_url with force flag, Examples (#1)
cucumber features/oembed.feature:51 # Scenario Outline: Get multiple provider_urls, Examples (#1)
cucumber features/oembed.feature:52 # Scenario Outline: Get multiple provider_urls, Examples (#2)
cucumber features/oembed.feature:77 # Scenario Outline: Attempt multi get 404 URLs, Examples (#2)
cucumber features/oembed.feature:78 # Scenario Outline: Attempt multi get 404 URLs, Examples (#3)
21 scenarios (15 failed, 6 passed)
71 steps (15 failed, 1 skipped, 55 passed)
0m43.737s
I'm trying to use the extract method like you said in you page: http://embed.ly/extract but it doesn't work.
I'm using it like this:
require 'embedly'
require 'json'
embedly_api = Embedly::API.new :key => 'xxxxxxxxxxxxxxxxxxx',
:user_agent => 'Mozilla/5.0 (compatible; mytestapp/1.0; [email protected])'
obj = embedly_api.extract :url => 'http://embed.ly'
puts obj[0].marshal_dump
json_obj = JSON.pretty_generate(obj[0].marshal_dump)
It sends the following error log:
undefined method `extract' for #Embedly::API:0x007fef2443e408
Thanks.
Hey guys,
Seems like starting from yesterday we are seeing Bad Request
on any attempt to process any url.
The way we use the gem hasn't changed:
class EmbedlyExtractor
def initialize
@api = Embedly::API.new key: ENV['EMBEDLY_API_KEY'],
timeout: CourseUrl::EXTERNAL_SERVICES_TIMEOUT_IN_SECONDS,
user_agent: 'Mozilla/5.0 (compatible; exceedlms/1.0; [email protected])'
end
def extract(url)
@api.extract(url: url).first
end
end
The exception is:
Embedly::BadResponseException: Bad Response : #<Typhoeus::Response:0x00007f46c2b608e0
Does anybody else have this issue or know what's going on?
Thanks in advance.
http://embed.ly/docs/extract/features/ssl
How I can use this feature with embedly-ruby gem?
I can't find API or Intreface for it.
Running Ruby 1.9.2 on Heroku Celadon Cedar stack in Rails 3.1.3. It's possible the URL is not valid for Embedly, or even that it's entirely invalid. If this is the case, I would expect Embedly to return an error and perhaps raise some subclass of StandardError.
embedly = Embedly::API.new(:key => ENV['EMBEDLY_API_KEY'])
embedly_response = embedly.oembed :url => url, :width => 580
vendor/bundle/ruby/1.9.1/gems/embedly-1.0.0/lib/embedly/api.rb:118:in `apicall'
vendor/bundle/ruby/1.9.1/gems/embedly-1.0.0/lib/embedly/api.rb:169:in `method_missing'
[last line of above code]
Hi,
I am always getting below error with embedly-ruby code as,
Bad Response : #<Net::HTTPBadGateway 502 Bad Gateway readbody=true> for path: "/1/oembed?urls=http%3A%2F%2Fnewalbumreleases.net%2F49901%2Fbalthazar-rats-2012%2F&key=e84570e25ba24fd1bc8eec03bd3c8ec9&maxwidth=350"
code usage :
<% @OBJS = @api.oembed(
:url => any_url,
:maxwidth => 350
) %>
Please let me know If any ideas
ProTip: If you implement this, use query parameter oauth. Headers won't work with our service, I'm afraid.
I'm not seeing a .gemspec
file in this repository, and though I have Embedly in my Gemfile and installed with Bundler, Typhoeus is not listed as a dependency and it hasn't been installed. Browsing the Embedly source reveals that only with the command line options is Typhoeus set as the default network library.
Suggested Fix: either change the docs to note that Typhoeus must be specified in the Gemfile and Embedly configured appropriately and set the command line client to match, or switch the Embedly library to use Typhoeus by default. It might make sense to use Typhoeus when it's available and fallback to Net::HTTP by default.
When running tests, I get an error: webmock-1.8.11/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb:23:in `disable!'
When I remove the embedly gem, the tests run fine... would love to be able to use the embedly gem :)
Currently I just get this:
obj = embedly.oembed :url => 'http://www.youtube.com/watch?v=sPbJ4Z5D-n4&feature=topvideos'
Bad Response : #<Net::HTTPForbidden 403 Forbidden readbody=true> for path: "/1/oembed?urls=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DsPbJ4Z5D-n4%26feature%3Dtopvideos&key=e042535071fa40b4868bb96df465478c"
["/Users/jason/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/embedly-1.9.1/lib/embedly/api.rb:150:in `apicall'", "/Users/jason/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/embedly-1.9.1/lib/embedly/api.rb:199:in `method_missing'", "(pry):8:in `<main>'", "/Users/jason/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/pry-0.10.0/lib/pry/pry_instance.rb:353:in `eval'", "/Users/jason/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/pry-0.10.0/lib/pry/pry_instance.rb:353:in `evaluate_ruby'", "/Users/jason/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/pry-0.10.0/lib/pry/pry_instance.rb:321:in `handle_line'", "/Users/jason/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/pry-0.10.0/lib/pry/pry_instance.rb:241:in `block (2 levels) in eval'", "/Users/jason/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/pry-0.10.0/lib/pry/pry_instance.rb:240:in `catch'", "/Users/jason/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/pry-0.10.0/lib/pry/pry_instance.rb:240:in `block in eval'", "/Users/jason/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/pry-0.10.0/lib/pry/pry_instance.rb:239:in `catch'"]
Although I'm not actually 100% sure the problem is that the plan is inactive. But the plan is inactive because I don't have a credit card number to put in at the moment.
This line:
https://github.com/embedly/embedly-ruby/blob/master/lib/embedly/api.rb#L6
puts any methods and constants (in this case, VERSION
) in the global namespace. I haven't looked extensively, but I imagine that line's not necessary. If it is, there must be a better way to accomplish whatever it accomplishes.
I guess the library doest not considere javascript, so I'm receiving a "JavaScript is not available." using twitter url's for example.
My setup is: Rails v4
and the gem is: gem 'embedly', '~> 1.9'
thank you.
We're currently storing EmbedlyObjects
in a database serialized to YAML.
We are in the process of upgrading to ruby 2.3.1, but on YAML.load
we get a ArgumentError
because apparently the initializer is called without any arguments.
This could be caused by a behavioural change of the YAML parser/loader in ruby 2.3.1.
I'm in the process of searching for a solution for this problem.
Failure/Error: obj = new(YAML.load(yml)) if yml.present?
ArgumentError:
wrong number of arguments (given 0, expected 1)
# /Users/martijn/.gem/ruby/2.3.1/gems/embedly-1.9.1/lib/embedly/model.rb:6:in `initialize'
In embedly/api.rb
says that is possible to add new methods to the api, like this:
api = Embedly::API.new
api.api_version[:new_method] = 3
api.new_method :arg1 => '1', :arg2 => '2'
But this actually does not work, because in the method missing, you only delegate to methods defined in @endpoint
ivar.
https://github.com/embedly/embedly-ruby/blob/master/lib/embedly/api.rb#L205
Is this supposed to work this way? If yes, I can send a pull request to fix it.
I find EmbedlyObject
's behaviour to return nil
for non-existent members convenient. It would be even more convenient if (hash and) array members would return an object that behaves in a similar way, so that for example response.images.first.name
doesn't give an error when there are no associated images. I would have expected response.images
to be something like an EmbedlyObject
.
Right now I'm wrapping the response in an object containing something like
class MyEmbedly < SimpleDelegator
def initialize(url)
super(url)
end
def images
(super || []).map &OpenStruct.method(:new)
end
private
def data(url)
@embedly ||= Embedly::API.new key: ENV['EMBEDLY_KEY']
@data ||= @embedly.extract(url: url).first
end
end
but believe it could better be solved here.
We're trying to use Embedly in a 1.8.7 environment and are getting following exception raised on on simple oembed calls:
TypeError: can't convert Hash into String
from /opt/ruby-enterprise-1.8.7-2011.12/lib/ruby/1.8/net/http.rb:560:in `initialize'
from /opt/ruby-enterprise-1.8.7-2011.12/lib/ruby/1.8/net/http.rb:560:in `open'
from /opt/ruby-enterprise-1.8.7-2011.12/lib/ruby/1.8/net/http.rb:560:in `connect'
from /opt/ruby-enterprise-1.8.7-2011.12/lib/ruby/1.8/timeout.rb:53:in `timeout'
from /opt/ruby-enterprise-1.8.7-2011.12/lib/ruby/1.8/timeout.rb:101:in `timeout'
from /opt/ruby-enterprise-1.8.7-2011.12/lib/ruby/1.8/net/http.rb:560:in `connect'
from /opt/ruby-enterprise-1.8.7-2011.12/lib/ruby/1.8/net/http.rb:553:in `do_start'
from /opt/ruby-enterprise-1.8.7-2011.12/lib/ruby/1.8/net/http.rb:542:in `start'
from /opt/ruby-enterprise-1.8.7-2011.12/lib/ruby/1.8/net/http.rb:440:in `start'
from /opt/ruby-enterprise-1.8.7-2011.12/lib/ruby/gems/1.8/gems/embedly-1.5.1/lib/embedly/api.rb:75:in `_do_basic_call'
I traced the error back to a call to Net::HTTP.start
, which in 1.8.7 doesn't accept an options hash.
For some pages ebbed.ly returns a empty response.
For us helped the mechanize
So, is possible to pass extra param to Extract API for enabling of cookies or something else...?
It doesn't look like you are able to call /display/fill with the gem. You also can't call it as the action for apicall since that uses urls as the parameter but display/fill requires the parameter url
Adding the following in an initializer worked ok in Rails v3.2.13, but seemed to stop all logging output after upgrading to Rails v4.0.
Embedly.configure do |config|
config.logger = Rails.logger
end
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.