Class: Giddy::Client
- Inherits:
-
Object
- Object
- Giddy::Client
- Defined in:
- lib/giddy/client.rb
Instance Method Summary collapse
- #create_lightbox(name, attrs) ⇒ Object
-
#create_session ⇒ Object
not necessary typically, sessions will be autocreated.
- #get_lightbox(id, count = 20, start = 1) ⇒ Object
-
#initialize(username, password, token = nil, secure_token = nil) ⇒ Client
constructor
A new instance of Client.
- #lightboxes(count = 20, start = 1) ⇒ Object
- #search(attrs) ⇒ Object
- #secure_token ⇒ Object
- #set_system_credentials(system_id, system_password) ⇒ Object
- #token ⇒ Object
Constructor Details
Instance Method Details
#create_lightbox(name, attrs) ⇒ Object
47 48 49 50 |
# 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 ⇒ Object
not necessary typically, sessions will be autocreated
61 62 63 |
# File 'lib/giddy/client.rb', line 61 def create_session @mediator.create_session end |
#get_lightbox(id, count = 20, start = 1) ⇒ Object
40 41 42 43 44 45 |
# 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) ⇒ Object
33 34 35 36 37 38 |
# 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) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# 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 ⇒ Object
56 57 58 |
# File 'lib/giddy/client.rb', line 56 def secure_token @mediator.secure_token end |
#set_system_credentials(system_id, system_password) ⇒ Object
7 8 9 |
# 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 ⇒ Object
52 53 54 |
# File 'lib/giddy/client.rb', line 52 def token @mediator.token end |