lib/smile/photo.rb in smile-0.3.0 vs lib/smile/photo.rb in smile-0.3.1
- old
+ new
@@ -1,12 +1,10 @@
#
# photo.rb
# smile
#
# Created by Zac Kleinpeter on 2009-04-28.
-# Copyright 2009 Cajun Country. All rights reserved.
-#
class Smile::Photo < Smile::Base
class << self
# Convert the given xml into photo objects to play with
def from_json( json, session_id )
@@ -39,11 +37,11 @@
params = default_params.merge(
:method => 'smugmug.images.getInfo'
)
params.merge!( options ) if( options )
- json = RestClient.post Smile::Base::BASE, params
+ json = RestClient.post( Smile::Base::BASE, params ).body
image_upper = JSON.parse( json )
image = upper_hash_to_lower_hash( image_upper['Image'] )
image.merge!( :image_id => image["id"] )
image.merge!( :album_key => image["album"]["key"] )
@@ -62,53 +60,53 @@
# result. Additionally, the album owner must have specified that EXIF data is allowed. Note that
# many photos have no EXIF data, so an empty or partially returned result is very normal.#
#
# Arguments:*
#
- # String Password optional
- # String SitePassword optional
- #
# Result:* struct "Image" [some, none, or all may be returned]
- #
- # int "id"
- # String "DateTime"
- # String "DateTimeOriginal"
- # String "DateTimeDigitized"
- # String "Make"
- # String "Model"
- # String "ExposureTime"
- # String "Aperture"
- # int "ISO"
- # String "FocalLength"
- # int "FocalLengthIn35mmFilm"
- # String "CCDWidth"
- # String "CompressedBitsPerPixel"
- # int "Flash"
- # int "Metering"
- # int "ExposureProgram"
- # String "ExposureBiasValue"
- # int "ExposureMode"
- # int "LightSource"
- # int "WhiteBalance"
- # String "DigitalZoomRatio"
- # int "Contrast"
- # int "Saturation"
- # int "Sharpness"
- # String "SubjectDistance"
- # int "SubjectDistanceRange"
- # int "SensingMethod"
- # String "ColorSpace"
- # String "Brightness"
+ # int "id"
+ # String "DateTime"
+ # String "DateTimeOriginal"
+ # String "DateTimeDigitized"
+ # String "Make"
+ # String "Model"
+ # String "ExposureTime"
+ # String "Aperture"
+ # int "ISO"
+ # String "FocalLength"
+ # int "FocalLengthIn35mmFilm"
+ # String "CCDWidth"
+ # String "CompressedBitsPerPixel"
+ # int "Flash"
+ # int "Metering"
+ # int "ExposureProgram"
+ # String "ExposureBiasValue"
+ # int "ExposureMode"
+ # int "LightSource"
+ # int "WhiteBalance"
+ # String "DigitalZoomRatio"
+ # int "Contrast"
+ # int "Saturation"
+ # int "Sharpness"
+ # String "SubjectDistance"
+ # int "SubjectDistanceRange"
+ # int "SensingMethod"
+ # String "ColorSpace"
+ # String "Brightness"
+ #
+ # @param [options,Hash] options ruby and hashes are like.......
+ # @option options [String] :password a password field
+ # @option options [String] :site_password site password field
def details( options =nil )
params = default_params.merge(
:method => "smugmug.images.getEXIF",
:ImageID => self.image_id,
:ImageKey => self.key
)
params.merge!( options ) if( options )
- json = RestClient.post Smile::Base::BASE, params
+ json = RestClient.post( Smile::Base::BASE, params ).body
json = JSON.parse( json )
raise json["message"] if json["stat"] == 'fail'
image = upper_hash_to_lower_hash( json['Image'] )
@@ -163,11 +161,11 @@
:ImageID => self.image_id,
:ImageKey => self.key
)
params.merge!( options ) if( options )
- json = RestClient.post Smile::Base::BASE, params
+ json = RestClient.post( Smile::Base::BASE, params ).body
json = JSON.parse( json )
raise json["message"] if json["stat"] == 'fail'
image = upper_hash_to_lower_hash( json['Image'] )
@@ -214,11 +212,11 @@
:ImageID => self.image_id,
:ImageKey => self.key
)
params.merge!( options ) if( options )
- json = RestClient.post Smile::Base::BASE, params
+ json = RestClient.post( Smile::Base::BASE, params ).body
json = JSON.parse( json )
raise json["message"] if json["stat"] == 'fail'
image = upper_hash_to_lower_hash( json['Image'] )
@@ -228,6 +226,6 @@
end
def album
Smile::Album.find( :AlbumID => album_id, :AlbumKey => album_key )
end
-end
\ No newline at end of file
+end