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) ⇒ Object
-
#initialize(username, password, token = nil, secure_token = nil) ⇒ Client
constructor
A new instance of Client.
- #lightboxes(count = 1, 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
45 46 47 48 |
# File 'lib/giddy/client.rb', line 45 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
59 60 61 |
# File 'lib/giddy/client.rb', line 59 def create_session @mediator.create_session end |
#get_lightbox(id) ⇒ Object
40 41 42 43 |
# File 'lib/giddy/client.rb', line 40 def get_lightbox(id) attrs = { :LightboxId => id, :LightboxItemsViewOptions => { :ItemCount => 100, :ItemStartNumber => 1 } } LightboxHeaders.new(@mediator).get_lightbox(attrs) end |
#lightboxes(count = 1, start = 1) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/giddy/client.rb', line 33 def lightboxes(count=1, 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
54 55 56 |
# File 'lib/giddy/client.rb', line 54 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
50 51 52 |
# File 'lib/giddy/client.rb', line 50 def token @mediator.token end |