GithubHelp home page GithubHelp logo

flickraw's People

Contributors

apikas avatar baltazore avatar boncey avatar chrblabla avatar christopheradams avatar codener avatar cpuguy83 avatar cyclotron3k avatar dentarg avatar freeslugs avatar gesteves avatar hanklords avatar jkraemer avatar khustochka avatar kueda avatar loeschg avatar mendab1e avatar mratzloff avatar mtn avatar netqyq avatar nitoyon avatar octplane avatar parkr avatar ramin avatar rdp avatar srussking avatar tarebyte avatar tarko avatar viseztrance avatar zatton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flickraw's Issues

Gem no longer works

elise@cpu-2:~/Development/clients/memoryreel/Mreel-Mongo staging$ irb
irb(main):001:0> require 'rubygems'
require 'flick=> true
irb(main):002:0> require 'flickraw'
FlickRaw::FailedResponse: 'flickr.reflection.getMethods' - Invalid API Key (Key has expired)

Mocking Calls for faster tests execution

I am working on a Rails Project which needs integration with Flickr to get most recent public images. I am using flickraw for Flickr integration. In order to develop rspec tests and cucumber features, I need to mock Flickr Calls to avoid web calls and I found takaltoo/flickrmocks.

Flickr has updated their APIs, however, takaltoo/flickrmocks doesn't seem to be updated as per the new API specifications.

Is there any way I can do some mocking using flickraw itself. There is a way to mock the underlying web calls and return the expected response. Just looking for a clean and better way.

How do I run the tests?

I want to make sure it still works on Ruby 1.9 without the json gem.

I do: rake test, but I get errors saying: Invalid API Key

I have an API Key, but where do I set it to run the tests?

Small Typo in README.rdoc

There is a small typo in the README.rdoc. In your configuration example the config hash is called FlickrawOptions, when it should be FlickRawOptions.

token_rejected

i get FlickRaw::OAuth::FailedResponse (token_rejected) with rails in response to

FlickRaw.api_key= FLICKR_APP_ID
FlickRaw.shared_secret= FLICKR_APP_SECRET

if params[:oauth_token]
token = session[:flickr_token]
flickr.get_access_token(token[:oauth_token], token[:oauth_token_secret], params[:oauth_verifier])
@flickr_user = flickr.test.login.username
else
token = flickr.get_request_token(:oauth_callback => "XXXXX")
session[:flickr_token] = @token
flickr_url = flickr.get_authorize_url(token['oauth_token'], :perms => 'read')
end

Incorrect photo URL's

I believe there's a bug in the url_x (where x is: n, s, or something else) methods. Whenever I call the following:

FlickRaw.url_n(photoset)

I get a URL which looks like the following: http://farm9.staticflickr.com/8499/72157632367381040_eda82f692f_n.jpg. This results in the "This image or video is currently unavailable." Flickr image. As far as I can see, this is because of the fact that it contains the ID of the photoset instead of the value of the primary field.

In that URL 72157632367381040 is the ID of my photoset. When I replace that with the primary value. I get the following URL: http://farm9.staticflickr.com/8499/8318972536_eda82f692f_n.jpg, which results in the correct image.

I'll try to look into this when I get the time, if it hasn't been fixed by then.

If FlickRawOptions timeout is nil, it isn't set in http

For uploading videos with flickraw, I need to set the timeout value to nil (no timeout). However, flickraw only forwards that timeout value to the Http class if it's not nil:

I propose you change the following code
http.read_timeout = FlickRawOptions['timeout'] if FlickRawOptions['timeout']
to
http.read_timeout = FlickRawOptions['timeout'] if FlickRawOptions.key?('timeout')

I worked around this issue in ruby 1.9.1 by setting the timeout to 0 (not nil), but in ruby 1.9.2 this results in immediate timeouts. I think they changed/reimplemented the socket class in 1.9.2, which would explain the difference in behavior here.

Segfault when Looping

I get the following segfault message after running get.rb:

(eval):1: [BUG] Segmentation fault
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.7.0]

-- control frame ----------
c:0032 p:0018 s:0127 b:0127 l:000126 d:000126 CLASS  (eval):1
c:0031 p:0008 s:0125 b:0125 l:000116 d:000124 EVAL   (eval):1
c:0030 p:---- s:0123 b:0123 l:000122 d:000122 FINISH
c:0029 p:---- s:0121 b:0121 l:000120 d:000120 CFUNC  :eval
c:0028 p:0046 s:0117 b:0117 l:000116 d:000116 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:27
c:0027 p:---- s:0111 b:0111 l:000110 d:000110 FINISH
c:0026 p:---- s:0109 b:0109 l:000108 d:000108 CFUNC  :new
c:0025 p:0139 s:0104 b:0104 l:000103 d:000103 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:11
c:0024 p:0021 s:0098 b:0098 l:000078 d:000097 BLOCK  /usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:22
c:0023 p:---- s:0095 b:0095 l:000094 d:000094 FINISH
c:0022 p:---- s:0093 b:0093 l:000092 d:000092 CFUNC  :collect
c:0021 p:0089 s:0090 b:0088 l:000078 d:000087 BLOCK  /usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:22
c:0020 p:---- s:0084 b:0084 l:000083 d:000083 FINISH
c:0019 p:---- s:0082 b:0082 l:000081 d:000081 CFUNC  :each
c:0018 p:0030 s:0079 b:0079 l:000078 d:000078 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:19
c:0017 p:---- s:0073 b:0073 l:000072 d:000072 FINISH
c:0016 p:---- s:0071 b:0071 l:000070 d:000070 CFUNC  :new
c:0015 p:0139 s:0066 b:0066 l:000065 d:000065 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:11
c:0014 p:0333 s:0060 b:0060 l:000059 d:000059 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/api.rb:137
c:0013 p:0096 s:0050 b:0050 l:000049 d:000049 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/api.rb:56
c:0012 p:0019 s:0042 b:0042 l:000041 d:000041 METHOD (eval):3
c:0011 p:0036 s:0037 b:0037 l:001be8 d:000036 BLOCK  get.rb:37
c:0010 p:0008 s:0032 b:0032 l:000023 d:000031 BLOCK  /usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:41
c:0009 p:---- s:0029 b:0029 l:000028 d:000028 FINISH
c:0008 p:---- s:0027 b:0027 l:000026 d:000026 CFUNC  :each
c:0007 p:0013 s:0024 b:0024 l:000023 d:000023 METHOD /usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:41
c:0006 p:0077 s:0021 b:0021 l:001be8 d:000020 BLOCK  get.rb:35
c:0005 p:---- s:0016 b:0016 l:000015 d:000015 FINISH
c:0004 p:---- s:0014 b:0014 l:000013 d:000013 CFUNC  :each
c:0003 p:0178 s:0011 b:0011 l:001be8 d:0005a0 EVAL   get.rb:30
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001be8 d:001be8 TOP   
---------------------------
-- Ruby level backtrace information ----------------------------------------
get.rb:30:in `<main>'
get.rb:30:in `each'
get.rb:35:in `block in <main>'
/usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:41:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:41:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:41:in `block in each'
get.rb:37:in `block (2 levels) in <main>'
(eval):3:in `getExif'
/usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/api.rb:56:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/api.rb:137:in `process_response'
/usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:11:in `build'
/usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:11:in `new'
/usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:19:in `initialize'
/usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:19:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:22:in `block in initialize'
/usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:22:in `collect'
/usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:22:in `block (2 levels) in initialize'
/usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:11:in `build'
/usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:11:in `new'
/usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:27:in `initialize'
/usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.4/lib/flickraw/response.rb:27:in `eval'
(eval):1:in `initialize'
(eval):1:in `singletonclass'

-- C level backtrace information -------------------------------------------

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Abort trap: 6

Token rejected problem in auth flow.

I direct user to the URL generated by

flickr.get_request_token :oauth_callback => flickr_callback_image_import_url

After authorizing user is sent to this callback action

  def flickr_callback
    token = FlickRaw::Flickr.new.get_request_token :oauth_callback => flickr_callback_image_import_url
    raw_token = flickr.get_access_token(token['oauth_token'], token['oauth_token_secret'], params[:oauth_verifier])
  end

I get a 'token rejected' response from the flickr.get_access_token call every time. Can someone point me towards what I am doing wrong? I'd really appreciate it.

undefined method `get_request_token'

Hi,

I can't work this out. I'm simply trying with your first authenticated example. The first example, without authentication is working.

I have this code, running in a Ruby 1.9.2 environment, with FlickRaw installed through gem install flickraw in a dedicated RVM gemset:

require 'flickraw'

FlickRaw.api_key="ok_i_replaced_with_my_key"
FlickRaw.shared_secret="same_with_my_secret"

token = flickr.get_request_token(:perms => 'delete')

Running this, I already have a blocking issue: NoMethodError: undefined methodget_request_token' for #FlickRaw::Flickr:0x00000101180158`

I must have missed something somewhere, but what?

Thanks in advance,
Regards,

Romain

Encoding::CompatibilityError

Hi!

I randomly get an encoding error, here is the stack trace:

Encoding::CompatibilityError: incompatible character encodings: ASCII-8BIT and UTF-8
  from /home/deploy/apps/app/shared/bundle/ruby/1.9.1/bundler/gems/flickraw-15e07ed90020/lib/flickraw/oauth.rb:110:in `block (2 levels) in post_multipart'
  from /home/deploy/apps/app/shared/bundle/ruby/1.9.1/bundler/gems/flickraw-15e07ed90020/lib/flickraw/oauth.rb:101:in `each'
  from /home/deploy/apps/app/shared/bundle/ruby/1.9.1/bundler/gems/flickraw-15e07ed90020/lib/flickraw/oauth.rb:101:in `block in post_multipart'
  from /home/deploy/apps/app/shared/bundle/ruby/1.9.1/bundler/gems/flickraw-15e07ed90020/lib/flickraw/oauth.rb:152:in `block in post'
  from /home/deploy/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/net/http.rb:745:in `start'
  from /home/deploy/apps/app/shared/bundle/ruby/1.9.1/bundler/gems/flickraw-15e07ed90020/lib/flickraw/oauth.rb:147:in `post'
  from /home/deploy/apps/app/shared/bundle/ruby/1.9.1/bundler/gems/flickraw-15e07ed90020/lib/flickraw/oauth.rb:96:in `post_multipart'
  from /home/deploy/apps/app/shared/bundle/ruby/1.9.1/bundler/gems/flickraw-15e07ed90020/lib/flickraw/api.rb:145:in `upload_flickr'
  from /home/deploy/apps/app/shared/bundle/ruby/1.9.1/bundler/gems/flickraw-15e07ed90020/lib/flickraw/api.rb:91:in `upload_photo'
  from /home/deploy/apps/app/releases/20130805072010/app/platforms/flickr/photo.rb:16:in `block in share!'
  from /home/deploy/apps/app/releases/20130805072010/app/platforms/platform/photo.rb:42:in `cache_image'
  from /home/deploy/apps/app/releases/20130805072010/app/platforms/flickr/photo.rb:5:in `share!'
  from /home/deploy/apps/app/releases/20130805072010/app/models/share.rb:34:in `share!'
  from (irb):5
  from /home/deploy/apps/app/shared/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in `start'
  from /home/deploy/apps/app/shared/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in `start'
  from /home/deploy/apps/app/shared/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:41:in `<top (required)>'
  from script/rails:6:in `require'
  from script/rails:6:in `<main>' 

I've not managed to track down the line where this happens, or even reproduce the errors. It's just something that happens occasionally but when it happens it happens again given the same parameters.

Here is the part of my code where I call it. I've appended a fore_encoding to every String parameter but the error is still happening.

def share!
  is_public = Rails.env.production? ? 1 : 0

  cache_image do |image|
    uri       = URI.parse(image)
    mime_type = MIME::Types.type_for(uri.path).first.content_type.force_encoding('UTF-8')
    filename  = uri.path.split('/').last.force_encoding('UTF-8')
    file      = File.open(image)

    safety_level = 1
    if @photo.contains_adult_content?
      safety_level = 3
    end

    @base.flickraw.upload_photo UploadIO.new(file, mime_type, filename),
      title: @photo.title.force_encoding('UTF-8'),
      description: @photo.description.force_encoding('UTF-8'),
      tags: @photo.tag_list.each{ |t| t.gsub!(/\s/,'').force_encoding('UTF-8') }.join(' '),
      is_public: is_public,
      content_type: 1,
      safety_level: safety_level
  end
end

tag exclusion not working

according to the flickr docs, the tags should be able to do "-people" and exclude that tag. however when i have :tags => '-people' as part of the search arguments, i get a result set of photos who have that tag associated with it.

auth.rb example error - wrong number of args for post

Using 0.9.2 with example code (only modified to add API key).

$ ruby examples/auth.rb 
/Users/mroth/.rvm/gems/ruby-1.9.2-p290/gems/flickraw-0.9.2/lib/flickraw/oauth.rb:125:in `post': wrong number of arguments (3 for 4) (ArgumentError)
    from /Users/mroth/.rvm/gems/ruby-1.9.2-p290/gems/flickraw-0.9.2/lib/flickraw/oauth.rb:64:in `request_token'
    from /Users/mroth/.rvm/gems/ruby-1.9.2-p290/gems/flickraw-0.9.2/lib/flickraw/api.rb:61:in `get_request_token'
    from examples/auth.rb:10:in `<main>'

no such file to load -- flickraw/oauth

Since updating to the new version, I get this error when requiring flickraw in any script. See output here when trying to run example scripts.

mroth-imac ~:$ gem install flickraw
Fetching: flickraw-0.9.1.gem (100%)
Successfully installed flickraw-0.9.1
1 gem installed

mroth-imac ~:$ ruby examples/interestingness.rb 
/Users/mroth/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- flickraw/oauth (LoadError)
    from /Users/mroth/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/mroth/.rvm/gems/ruby-1.9.2-p290/gems/flickraw-0.9.1/lib/flickraw.rb:2:in `<top (required)>'
    from <internal:lib/rubygems/custom_require>:33:in `require'
    from <internal:lib/rubygems/custom_require>:33:in `rescue in require'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from examples/interestingness.rb:1:in `<main>'

mroth-imac ~:$ ruby examples/auth.rb 
/Users/mroth/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- flickraw/oauth (LoadError)
    from /Users/mroth/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/mroth/.rvm/gems/ruby-1.9.2-p290/gems/flickraw-0.9.1/lib/flickraw.rb:2:in `<top (required)>'
    from <internal:lib/rubygems/custom_require>:33:in `require'
    from <internal:lib/rubygems/custom_require>:33:in `rescue in require'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from examples/auth.rb:1:in `<main>'

url_m() does not seem to be fetching the medium photo

So far as I can tell url_m() is returning the small sized photo, and url_s is returning the thumbnail sized photo. This could just be me misunderstanding flickr's size designations though.

EDIT

I think I sorted this out. I wanted to access the size flickr calls medium 500 but you get there by using regular url() without an underscore designation.

OAuth Request Token Doesn't Work

Whenever I try to get a request token using:

FlickRaw.api_mkey = consumer_key
FlickRaw.shared_secret = consumer_secret
token = flickr.get_request_token(:perms => 'delete')

It throws an exception: "NameError (undefined local variable or method `token_secret' for #FlickRaw::OAuth:0x1f3f068)"

After looking through your code I think the problem comes from:

def request_token(url, oauth_params = {})
   r = post_form(url, token_secret, {:oauth_callback => "oob"}.merge(oauth_params))
   OAuth.parse_response(r.body)
end

because token_secret isn't defined. When I replaced it with @consumer_secret it gave me an error about the signature not being valid.

args overwritten with {}

There was a small mistake in commit eb69606, 2009-11-11.
In flickraw.rb, lines 177 and 184 (upload_photo and replace_photo), args was overwritten with {} in the call to upload_flickr.
I'm happy to see that these functions are implemented!

Inconsistent return values from getPhotos methods

Flickr.people.getPhotos returns a Flickraw.ResponseList

Flickr.photosets.getPhotos returns a Flickraw.Response -- in exactly the same format as above.

Is this intentional? It's messing up our code a bit, since we were calling .to_a on the ResponseList but then if we get try to photos from a set, it has no .to_a method.

Cc @pozorvlak

@token is retained and used for methods that don't need authentication

I hope I haven't missed something here, but I've got a simple use case which will always make a simple test app fail.
You can get the app here: http://github.com/olance/flickraw-test

It is really simple: it asks for authentication, associates the token to the User model and then shows the photos with some pagination.
The problem shows when you revoke the permission from your Flickr account, while already authorized on the app. The index action will then have a FlickRaw::FailedResponse exception raised on refresh, so it will redirect to the auth page again.
There, the flickr.auth.getFrob call also raises a FlickRaw::FailedResponse, with message "Invalid auth token". According to the Flickr API, this error should never come up on a call to getFrob.

From my understanding of your code, it looks like the token is always passed as a parameter when it is not nil, which seems to be a problem when calling a method that doesn't require it.
I think the simplest thing would be to provide an accessor on auth_token, allowing to reset the token?
Thus I could set flickr.auth_token = nil when checkToken fails, and call getFrob again without failure.

Broken oauth in 0.9.3?

I couldn't connect with 0.9.3 but 0.9 was fine.

FlickRaw.api_key="8a8.....5aa0a"
=> "8......05aa0a"
FlickRaw.shared_secret="11...684b"
=> "11....4b"
?> flickr
ArgumentError: wrong number of arguments (7 for 6)
from /Library/Ruby/Gems/1.8/gems/flickraw-0.9.3/lib/flickraw/oauth.rb:134:in start' from /Library/Ruby/Gems/1.8/gems/flickraw-0.9.3/lib/flickraw/oauth.rb:134:inpost'
from /Library/Ruby/Gems/1.8/gems/flickraw-0.9.3/lib/flickraw/oauth.rb:81:in post_form' from /Library/Ruby/Gems/1.8/gems/flickraw-0.9.3/lib/flickraw/api.rb:52:incall'
from /Library/Ruby/Gems/1.8/gems/flickraw-0.9.3/lib/flickraw/api.rb:43:in initialize' from /Library/Ruby/Gems/1.8/gems/flickraw-0.9.3/lib/flickraw.rb:17:innew'
from /Library/Ruby/Gems/1.8/gems/flickraw-0.9.3/lib/flickraw.rb:17:in `flickr'
from (irb):6

no such file to load -- md5 (LoadError)

I love flickraw. I am trying to get it to work with ruby1.9, and get the following error when loading an app that requires flickraw:
/opt/local/lib/ruby1.9/gems/1.9.1/gems/flickraw-0.5.1/lib/flickraw.rb:24:in `require’: no such file to load — md5 (LoadError)

thanks for your great work on this project!

flickr method defined globally

This gem creates an unscoped flickr method. It interferes with scopes and other things of the same name. It ends up causing this exception:

"RuntimeError: No API key or secret defined !"

I was able to get around that error by moving the require line from outside the class to inside a method declaration.

OAuthClient::escape problem

Hello,

flickraw cannot use Japanese, maybe after this change.
#39

/Users/xxxxx/.rvm/gems/ruby-1.8.7-p357/gems/flickraw-0.9.5/lib/flickraw/oauth.rb:151:in post': signature_invalid (FlickRaw::OAuthClient::FailedResponse) from /Users/xxxxx/.rvm/gems/ruby-1.8.7-p357/gems/flickraw-0.9.5/lib/flickraw/oauth.rb:86:inpost_form'
from /Users/xxxxx/.rvm/gems/ruby-1.8.7-p357/gems/flickraw-0.9.5/lib/flickraw/api.rb:53:in call' from (eval):3:ineditMeta'
from /Users/xxxxx/Documents/Aptana Studio 3 Workspace/flickr/flickr.rb:97
from /Users/xxxxx/Documents/Aptana Studio 3 Workspace/flickr/flickr.rb:95:in `each'
from /Users/xxxxx/Documents/Aptana Studio 3 Workspace/flickr/flickr.rb:95

using this monkey patch, it's ok.

require "flickraw"
module FlickRaw
  class OAuthClient
    class << self
      def escape(v); URI.escape(v.to_s, /[^a-zA-Z0-9\-\.\_\~]/) end
    end
  end
end

Thanks,
kinumi

Why isn't json in your gemspec?

Seems to break on: require 'json'

If you have the require, is it worth adding it to your gemspec?

Bundler.require
LoadError: no such file to load -- json
from /Library/Ruby/Gems/1.8/gems/flickraw-0.9/lib/flickraw.rb:24:in require' from /Library/Ruby/Gems/1.8/gems/flickraw-0.9/lib/flickraw.rb:24 from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:inrequire'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in require' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:ineach'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in require' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:ineach'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:in require' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler.rb:112:inrequire'
from (irb):1

Thanks,
Dan

the README.doc

i follow the steps from Usage Sample

irb(main):001:0> require "flickraw"
=> true
irb(main):002:0> list = flickr.photos.getRescent
FlickRaw::FailedResponse: 'flickr.reflection.getMethods' - Invalid API Key (Key has invalid format)

add below to README.doc in Usage Sample

  FlickRaw.api_key="... Your API key ..." 
  FlickRaw.shared_secret="... Your shared secret ..." 

then it works.

api_sig: uninitialized constant Module::MD5 (NameError)

I get following error with ruby 1.9.1 and flickraw 0.6:
/opt/local/lib/ruby1.9/gems/1.9.1/gems/flickraw-0.6/lib/flickraw.rb:233:in `api_sig': uninitialized constant Module::MD5 (NameError)

I saw in few another libraries that MD5 become Digest::MD5.

Hope you can help,
Thanks.

build_args does not work with ruby 1.9.1

My project hosted on heroku (heroku.com) was running fine locally on ruby 1.9.1 but was crashing on heroku on ruby 1.9.1. After several back and forth messages between heroku support and myself we eventually found the problem inside build_args.

Basically what it boils down to is that on ruby 1.9.1's Net::HTTP's Request#set_form_data (which is what the results from build_args get passed to ) does not support symbols as key names and expects strings. The result is a crash like this:

TypeError - can't dup Symbol: 
/usr/ruby1.9.1/lib/ruby/1.9.1/net/http.rb:1529:in `dup' 
/usr/ruby1.9.1/lib/ruby/1.9.1/net/http.rb:1529:in `urlencode' 
/usr/ruby1.9.1/lib/ruby/1.9.1/net/http.rb:1524:in `block in encode_kvpair' 
/usr/ruby1.9.1/lib/ruby/1.9.1/net/http.rb:1524:in `map' 
/usr/ruby1.9.1/lib/ruby/1.9.1/net/http.rb:1524:in `encode_kvpair' 
/usr/ruby1.9.1/lib/ruby/1.9.1/net/http.rb:1517:in `block in set_form_data' 
/usr/ruby1.9.1/lib/ruby/1.9.1/net/http.rb:1517:in `each' 
/usr/ruby1.9.1/lib/ruby/1.9.1/net/http.rb:1517:in `map' 
/usr/ruby1.9.1/lib/ruby/1.9.1/net/http.rb:1517:in `set_form_data' 
/home/slugs/230721_f0c96b5_e2e4/mnt/.gems/gems/flickraw-0.8.3/lib/flickraw.rb:162:in `block in call' 
/home/slugs/230721_f0c96b5_e2e4/mnt/.gems/gems/flickraw-0.8.3/lib/flickraw.rb:205:in `block in open_flickr' 

I've managed to "Monkey Patch" my own project for now by using the following code before I use any FlickRaw code:

module FlickRaw
  class Flickr
    alias :broken_build_args :build_args
    def build_args(args={}, req = nil)
      Hash[*broken_build_args(args,req).map{|key,val|[key.to_s,val]}.flatten]
    end
  end
end

However this is not ideal and I think the build_args function should be changed to use strings rather than symbols for it's keys.

Searching multiple licenses

Flickr documentation says you can comma separate licenses in a photo search and it will search by all of them, however :license => '1,2,3,4' in flickraw isn't working. Any ideas? Thanks in advance!

@access_secret not initialized in api.rb

I get the following error when running FlickRaw:

/usr/local/lib/ruby/gems/1.9.1/gems/flickraw-0.9.5/lib/flickraw/api.rb:54: warning: instance variable @access_secret not initialized

I took a look at api.rb and could implement a patch, but in several different ways. I'm a beginner/intermediate rubyist, so I thought I'd ask you to fix it the way you think is best. Thanks!

[flickraw-cached] flickr.people.getPhotos produces NoMethodError exception

Not sure if this is the right place for this issue...

I tried to use Flickraw-cached gem, but calling flickr.people.getPhotos always raises a NoMethodError exception:
NoMethodError (undefined method `getPhotos' for #FlickRaw::Flickr::People:0x102ee52c0)

Switching to the regular Flickraw gem resolved the problem.

File not closed after upload

It seems as though the file is not closed once it is uploaded.
This can be handled outside Flickraw when passing an I/O stream, but if passing a file path instead it cannot be.

OpenSSL issue since upgrade to flickraw 0.9

SInce my upgrade to flickraw 0.9 I get this error for authenticated requests:

/Library/Ruby/Gems/1.8/gems/flickraw-0.9/lib/flickraw.rb:79:in 'gen_nonce': uninitialized constant FlickRaw::OAuth::OpenSSL (NameError)
from /Library/Ruby/Gems/1.8/gems/flickraw-0.9/lib/flickraw.rb:82:in 'gen_default_params'
from /Library/Ruby/Gems/1.8/gems/flickraw-0.9/lib/flickraw.rb:104:in 'post_form'
from /Library/Ruby/Gems/1.8/gems/flickraw-0.9/lib/flickraw.rb:286:in 'call'
from /Library/Ruby/Gems/1.8/gems/flickraw-0.9/lib/flickraw.rb:278:in 'initialize'
from /Library/Ruby/Gems/1.8/gems/flickraw-0.9/lib/flickraw.rb:426:in 'new'
from /Library/Ruby/Gems/1.8/gems/flickraw-0.9/lib/flickraw.rb:426:in 'flickr'
from /Users/gato/Desktop/testflickr.rb:11

I'm on Mac OS X Lion. Before the upgrade everything worked perfect.
What am I doing wrong?

Regards,
gato

Handling Gzipped responses from Flickr

Recently I started seeing this exception:

795: unexpected token at ''
/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/json-1.8.0/lib/json/common.rb:155:in `parse'
/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/json-1.8.0/lib/json/common.rb:155:in `parse'
/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/json-1.8.0/lib/json/common.rb:334:in `load'
/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/flickraw-0.9.6/lib/flickraw/api.rb:137:in `process_response'
/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/flickraw-0.9.6/lib/flickraw/api.rb:63:in `call'
/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/flickraw-0.9.6/lib/flickraw/api.rb:44:in `initialize'
/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/flickraw-0.9.6/lib/flickraw.rb:17:in `new'
/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/flickraw-0.9.6/lib/flickraw.rb:17:in `flickr'

Looking at tcpdump it seemed to be failing on a POST to http://api.flickr.com/services/rest/ with a Content-Encoding: gzip response header.

In flickraw/api.rb it seems to be passing the body of the http response directly to process_response without gunzipping it.

JSON.load should be JSON.parse I think

Hi, I am getting this error when I load (require) flickraw.

/Library/Ruby/Gems/1.8/gems/flickraw-0.8/lib/flickraw.rb:166:in call:NoMethodError: private method load called for JSON:Module

I think on line 166 you should call JSON.parse and not JSON.load

Stack level too deep when authenticating from rails

Hello,

I've been trying to follow the readme's Authentication chapter precisely, for a rails site, and noticed that on the following circumstances:

  1. Controller A displays auth link
  2. User clicks the link, approves a web-app
  3. Gets redirected to Controller B

flickraw falls with "stack level too deep" when trying to fetch a token (flickr.auth.getToken :frob => params[:frob]). Changing the call to FlickRaw::Flickr.new.auth.getToken works as expected (authentication passes).

Though I am not sure if this is indeed flickraw issue, I'd like to ask for a bit more clarification on how to use flickraw for rails, if that's possible?

What I am doing now for rails 2.3.4 is:

environment.rb:
config.gem "flickraw", :version => '>= 0.7.1', :source => "http://gems.github.com"

initialisers/flickraw.rb:
FlickRaw.api_key = 'blah'
FlickRaw.shared_secret = 'blah'

controllers/application_controller.rb

require 'flickraw' # this is actually the only place where it is declared

def get_flickr
FlickRaw::Flickr.new
end

And anywhere I need an API call:
get_flickr.make.a.call()

And I feel that I am doing something wrong... Especially assuming that library lazy loading should be utilised somehow somewhere... But for me this configuration at least works. Again, could someone please provide a short clarification on using flickraw with current production rails? Many thanks in advance!

With photos more than 4MB, I have this error.

D:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill': Timeout:
:Error (Timeout::Error)
        from D:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:140:in `rbuf_fill'
        from D:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
        from D:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
        from D:/Ruby193/lib/ruby/1.9.1/net/http.rb:2562:in `read_status_line'
        from D:/Ruby193/lib/ruby/1.9.1/net/http.rb:2551:in `read_new'
        from D:/Ruby193/lib/ruby/1.9.1/net/http.rb:1319:in `block in transport_r
equest'
        from D:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in `catch'
        from D:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in `transport_request'
        from D:/Ruby193/lib/ruby/1.9.1/net/http.rb:1293:in `request'
        from D:/Ruby193/lib/ruby/gems/1.9.1/gems/flickraw-0.9.6/lib/flickraw/oau
th.rb:153:in `block in post'
        from D:/Ruby193/lib/ruby/1.9.1/net/http.rb:745:in `start'
        from D:/Ruby193/lib/ruby/gems/1.9.1/gems/flickraw-0.9.6/lib/flickraw/oau
th.rb:147:in `post'
        from D:/Ruby193/lib/ruby/gems/1.9.1/gems/flickraw-0.9.6/lib/flickraw/oau
th.rb:96:in `post_multipart'
        from D:/Ruby193/lib/ruby/gems/1.9.1/gems/flickraw-0.9.6/lib/flickraw/api
.rb:138:in `upload_flickr'
        from D:/Ruby193/lib/ruby/gems/1.9.1/gems/flickraw-0.9.6/lib/flickraw/api
.rb:90:in `upload_photo'

Exception happening on production (Heroku)

When I call:
frob = flickr.auth.getFrob

Any ideas?

TypeError (can't dup Symbol):
/usr/ruby1.9.1/lib/ruby/1.9.1/net/http.rb:1529:in dup' /usr/ruby1.9.1/lib/ruby/1.9.1/net/http.rb:1529:inurlencode'
/usr/ruby1.9.1/lib/ruby/1.9.1/net/http.rb:1524:in block in encode_kvpair' /usr/ruby1.9.1/lib/ruby/1.9.1/net/http.rb:1524:inmap'
/usr/ruby1.9.1/lib/ruby/1.9.1/net/http.rb:1524:in encode_kvpair' /usr/ruby1.9.1/lib/ruby/1.9.1/net/http.rb:1517:inblock in set_form_data'
/usr/ruby1.9.1/lib/ruby/1.9.1/net/http.rb:1517:in each' /usr/ruby1.9.1/lib/ruby/1.9.1/net/http.rb:1517:inmap'
/usr/ruby1.9.1/lib/ruby/1.9.1/net/http.rb:1517:in set_form_data' .gems/gems/flickraw-0.8.3/lib/flickraw.rb:162:inblock in call'
.gems/gems/flickraw-0.8.3/lib/flickraw.rb:205:in block in open_flickr' /usr/ruby1.9.1/lib/ruby/1.9.1/net/http.rb:564:instart'
/usr/ruby1.9.1/lib/ruby/1.9.1/net/http.rb:453:in start' .gems/gems/flickraw-0.8.3/lib/flickraw.rb:203:inopen_flickr'
.gems/gems/flickraw-0.8.3/lib/flickraw.rb:160:in call' .gems/gems/flickraw-0.8.3/lib/flickraw.rb:150:ininitialize'
.gems/gems/flickraw-0.8.3/lib/flickraw.rb:317:in new' .gems/gems/flickraw-0.8.3/lib/flickraw.rb:317:inflickr'
app/controllers/flickrs_controller.rb:89:in `new'

Hi~ I have upload image problem

hello hanklords~

Thanks for your flickr lib ,
When I use upload method , I have a problem as below

ArgumentError (wrong number of arguments (1 for 0)):
  app/controllers/news_controller.rb:72:in `upload_photo'

This is my upload.html.haml

 =form_tag ({:action => :upload_photo},:multipart => true )do 
 = hidden_field_tag :token, @upload_info[:token] 
 = label_tag "Upload Photo" 
 = file_field_tag :photo 
 = submit_tag "Upload Photo" 

And My controller is

 def upload_photo
  FlickRaw.api_key=FlickrawConfig.key
  FlickRaw.shared_secret=FlickrawConfig.shared_secret
  flickr.upload_photo params[:photo] ,:title => "Title", :description => "This is the description"

Sorry to bother you ,
If it is possible , maybe a easy demo will help novice like me ~ thanks

like youtube_it :
Example Rails 3 App
You can get an example how you can use youtube_it with Rails 3 here: github.com/chebyte/youtube_it_rails_app_example

OAuth status?

Hi, I see stuff in the code for OAuth - is it all ready to use?
I ask as there's no mention in the main readme or the examples.

Folks on the Flickr API group are getting antsy about the potential end of the old authentication mechanism.
I'm ready to move my stuff over if/when Flickraw supports it.

If it is all working, some examples would be really useful.

Thanks, Darren.

Illogical argument error when using photos.search with contacts argument

This is the call I'm making:

photos = flickr.photos.search(:user_id => 'me', :license => 4, :faves => 1, :contacts => "all")

it's the :contacts bit that does it; if i leave that off, it's fine. granted, your documentation says this:

Search your contacts. Either ‘all’ or ‘ff’ for just friends and family. (Experimental)

I also tried "ff" instead of "all" as mentioned in the docs, but the same error happens. This would be a really useful feature. I tried using the Pry debugger to see why in api.rb it was failing, but didn't get far.

/Users/dominick/.rvm/gems/ruby-1.9.3-p385/gems/flickraw-0.9.6/lib/flickraw/api.rb:127:in `process_response': 'flickr.photos.search' - Illogical arguments (FlickRaw::FailedResponse)
    from /Users/dominick/.rvm/gems/ruby-1.9.3-p385/gems/flickraw-0.9.6/lib/flickraw/api.rb:54:in `call'
    from (eval):3:in `search'
    from flickraw_test.rb:75:in `get_creative_common_faves'
    from flickraw_test.rb:92:in `<main>'

Is json gem needed for Ruby 1.9?

When I did gem install flickraw, it installed the gem json-1.5.1. For Ruby 1.9, require 'json' is supported out of the box, so is this necessary?

If not, please use something like gem "json", :platforms => [:ruby_18, :jruby, :mswin, :mingw_18] in the Gemfile.

I like to keep my gem list as clean as possible. :)

Ref: http://gembundler.com/man/gemfile.5.html

Thanks!

Matt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.