class Giddy::Client
Public Class Methods
new(username, password, token=nil, secure_token=nil)
click to toggle source
# File lib/giddy/client.rb, line 3 def initialize(username, password, token=nil, secure_token=nil) @mediator = Mediator.new(username, password, token, secure_token) end
Public Instance Methods
create_lightbox(name, attrs)
click to toggle source
# File lib/giddy/client.rb, line 47 def create_lightbox(name, attrs) attrs = { :LightboxName => name }.merge(attrs) LightboxHeaders.new(@mediator).create_lightbox(attrs) end
create_session()
click to toggle source
not necessary typically, sessions will be autocreated
# File lib/giddy/client.rb, line 61 def create_session @mediator.create_session end
get_lightbox(id, count=20, start=1)
click to toggle source
# File lib/giddy/client.rb, line 40 def get_lightbox(id, count=20, start=1) # Yes, this just returns info for a lightbox, but you can control the list of images # in this lightbox with the pagination parameters attrs = { :LightboxId => id, :LightboxItemsViewOptions => { :ItemCount => count, :ItemStartNumber => start } } LightboxHeaders.new(@mediator).get_lightbox(attrs) end
lightboxes(count=20, start=1)
click to toggle source
# File lib/giddy/client.rb, line 33 def lightboxes(count=20, start=1) attrs = { :ResultsViewOptions => { :ItemCount => count, :ItemStartNumber => start } } LightboxHeaders.new(@mediator).get_lightbox_headers(attrs) end
search(attrs)
click to toggle source
# File lib/giddy/client.rb, line 11 def search(attrs) if attrs.has_key?(:image_id) and attrs.keys.length == 1 return Search.new(@mediator).get_image_details(attrs[:image_id]).first elsif attrs.has_key?(:image_ids) and attrs.keys.length == 1 return Search.new(@mediator).get_image_details(attrs[:image_ids]) end attrs = { :limit => 25, :start => 1, :query => "", :additional => {} }.merge(attrs) converted = { :Query => { :SearchPhrase => attrs[:query] }, :ResultOptions => { :ItemCount => attrs[:limit], :ItemStartNumber => attrs[:start] } } attrs = converted.merge(attrs[:additional]) Search.new(@mediator).search_for_images(attrs) end
secure_token()
click to toggle source
# File lib/giddy/client.rb, line 56 def secure_token @mediator.secure_token end
set_system_credentials(system_id, system_password)
click to toggle source
# File lib/giddy/client.rb, line 7 def set_system_credentials(system_id, system_password) @mediator.set_system_credentials system_id, system_password end
token()
click to toggle source
# File lib/giddy/client.rb, line 52 def token @mediator.token end