Class: Flickr::Api::General

Inherits:
Abstract show all
Defined in:
lib/flickr/api/general.rb

Instance Method Summary collapse

Methods inherited from Abstract

#find

Instance Method Details

#get_methods(params = {}) ⇒ Array<String>

Returns:

  • (Array<String>)

Documentation:


45
46
47
48
# File 'lib/flickr/api/general.rb', line 45

def get_methods(params = {})
  response = get "reflection.getMethods", params
  response["methods"]["method"].map { |hash| hash["_content"] }
end

#replace(photo, photo_id, params = {}) ⇒ String

Examples:

photo = File.open("/path/to/dandelions.jpg")
Flickr.replace(photo, photo_id, title: "Dandelions")

Parameters:

  • photo (String, File, Rails, Sinatra)

    Photo to upload

  • photo_id (String)

    ID of the photo which will be replaced

  • params (Hash) (defaults to: {})

    See documentation below

Returns:

  • (String)

    ID of the uploaded photo (if synchronous)

  • (String)

    ID of the upload ticket (if asynchronous)

Documentation:


36
37
38
39
# File 'lib/flickr/api/general.rb', line 36

def replace(photo, photo_id, params = {})
  response = super params.merge(photo: SanitizedFile.new(photo), photo_id: photo_id)
  params[:async] == 1 ? response["ticketid"] : response["photoid"]["__content__"]
end

#test_echo(params = {}) ⇒ Hash

Returns:

  • (Hash)

Documentation:


62
63
64
# File 'lib/flickr/api/general.rb', line 62

def test_echo(params = {})
  get "test.echo", params
end

#test_login(params = {}) ⇒ Hash

Returns:

  • (Hash)

Documentation:


54
55
56
# File 'lib/flickr/api/general.rb', line 54

def (params = {})
  get "test.login", params
end

#test_null(params = {}) ⇒ Hash

Returns:

  • (Hash)

Documentation:


70
71
72
# File 'lib/flickr/api/general.rb', line 70

def test_null(params = {})
  get "test.null", params
end

#upload(photo, params = {}) ⇒ String

Examples:

photo = File.open("/path/to/dandelions.jpg")
Flickr.upload(photo, title: "Dandelions")

Parameters:

  • photo (String, File, Rails, Sinatra)

    Photo to upload

  • params (Hash) (defaults to: {})

    See documentation below

Returns:

  • (String)

    ID of the uploaded photo (if synchronous)

  • (String)

    ID of the upload ticket (if asynchronous). See UploadTicket#check.

Documentation:


19
20
21
22
# File 'lib/flickr/api/general.rb', line 19

def upload(photo, params = {})
  response = super params.merge(photo: SanitizedFile.new(photo))
  params[:async] == 1 ? response["ticketid"] : response["photoid"]
end