Permalink
Browse files

updating the vimrc

  • Loading branch information...
1 parent 625e2cc commit 5a9ffe3d9f46cddf0562d8fe68d892dd785c0bd6 @cajun committed May 4, 2011
Showing with 24 additions and 19 deletions.
  1. +2 −2 lib/smile/common.rb
  2. +5 −5 lib/smile/param_converter.rb
  3. +17 −12 lib/smile/photo.rb
View
4 lib/smile/common.rb
@@ -17,14 +17,14 @@ def default_params
@params = Smile::ParamConverter.clean_hash_keys( @params )
end
- # This is the base work that will need to be done on ALL
+ # This is the base work that will need to be done on ALL
# web calls. Given a set of web options and other params
# call the web service and convert it to json
def web_method_call( web_options, options = {} )
base_web_method_call( web_options, options, BASE )
end
- # This is the base work that will need to be done on ALL
+ # This is the base work that will need to be done on ALL
# web calls. Given a set of web options and other params
# call the web service and convert it to json
def secure_web_method_call( web_options, options = {} )
View
10 lib/smile/param_converter.rb
@@ -1,8 +1,8 @@
module Smile::ParamConverter
module_function
-
+
# The smugmug api does not use all lowercase for params. Depending on the service call the
- # case my be different. This converter will normalize the params that are passed to the smugmug
+ # case my be different cases. This converter will normalize the params that are passed to the smugmug
# api.
#
# Example:
@@ -53,18 +53,18 @@ def convert( param, value=nil )
else
key = param
end unless param.nil?
-
+
[ key, value ]
end
-
+
def clean_hash_keys( hash_to_clean )
cleaned_hash ={}
hash_to_clean.each_pair do |key,value|
cleaned_hash[convert( key ).first] = value
end if( hash_to_clean )
cleaned_hash
end
-
+
def first_letter_downcase( stuff )
stuff.to_s.gsub( /^(\w)/, $1.downcase )
end
View
29 lib/smile/photo.rb
@@ -10,9 +10,12 @@ def from_json( json )
logger.info( json )
json["images"].map do |image_upper|
image = upper_hash_to_lower_hash( image_upper )
- image.merge!( :image_id => image["id"] )
- image.merge!( :album_key => image["album"]["key"] )
- image.merge!( :album_id => image["album"]["id"] )
+ image.merge!( {
+ :image_id => image["id"],
+ :album_key => image["album"]["key"],
+ :album_id => image["album"]["id"]
+ } )
+
image.delete( 'album' )
Smile::Photo.new( image )
@@ -35,9 +38,11 @@ def find( options={} )
image = image['image']
logger.info( image )
- image.merge!( :image_id => image["id"] )
- image.merge!( :album_key => image["album"]["key"] )
- image.merge!( :album_id => image["album"]["id"] )
+ image.merge!( {
+ :image_id => image["id"],
+ :album_key => image["album"]["key"],
+ :album_id => image["album"]["id"]
+ } )
image.delete( 'album' )
Smile::Photo.new( image )
@@ -48,7 +53,7 @@ def find( options={} )
# The Album must be owned by the Session holder, or else be Public (if password-protected, a
# Password must be provided), to return results. Otherwise, an "invalid user" faultCode will
# 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.#
+ # many photos have no EXIF data, so an empty or partially returned result is very normal.#
#
# Arguments:*
#
@@ -183,18 +188,18 @@ def info( options =nil )
# String "X3LargeURL" (if available)
# String "OriginalURL" (if available)
def urls( options =nil )
- image = web_method_call( {
+ image = web_method_call( {
:method => "smugmug.images.getURLs",
:ImageID => self.image_id,
:ImageKey => self.key
}, options
)
-
+
image.merge!( :image_id => image["id"] )
-
- OpenStruct.new( image )
+
+ OpenStruct.new( image )
end
-
+
def album
@album ||= Smile::Album.find( :AlbumID => self.album_id, :AlbumKey => self.album_key )
end

0 comments on commit 5a9ffe3

Please sign in to comment.