Changeset 173

Show
Ignore:
Timestamp:
04/13/05 20:21:27 (3 years ago)
Author:
scoop
Message:
  • Merged spamprot changesets [155] and [156] since they affect trunk as well
  • Prefix relative path with :controller => since url_for just returns the passed relative path if we don't do that (fixes #26)
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/app/apis/blogger_service.rb

    r172 r173  
    2121 
    2222 
    23 class BloggerService < ActionWebService::Bas
     23class BloggerService < TypoWebServic
    2424  web_service_api BloggerApi 
    2525 
     
    3939  def getUsersBlogs(appkey, username, password) 
    4040    [BloggerStructs::Blog.new( 
    41       :url      => controller.url_for("/"), 
     41      :url      => controller.url_for(:controller => "/"), 
    4242      :blogid   => 1, 
    4343      :blogName => config['blog_name'] 
    4444    )] 
    4545  end 
    46    
    47   private 
    48  
    49   # FIXME: This method can be rewritten using API::Method#expects_index_of and API::Method#expects_to_hash 
    50   #       available in the next Rails release 
    51   def authenticate(name, args) 
    52     method_expects = self.class.web_service_api.api_methods[name][:expects] 
    53     username, password = method_expects.index(:username=>String), method_expects.index(:password=>String) 
    54  
    55     raise "Invalid login" unless User.authenticate?(args[username], args[password]) 
    56   end 
    57    
    5846end 
  • trunk/app/apis/meta_weblog_service.rb

    r172 r173  
    1515    member :mt_convert_breaks,  :string 
    1616    member :mt_tb_ping_urls,    :string 
    17     member :dateCreated,        :string 
     17    member :dateCreated,        :datetime 
    1818  end 
    1919 
     
    6464 
    6565 
    66 class MetaWeblogService < ActionWebService::Bas
     66class MetaWeblogService < TypoWebServic
    6767  web_service_api MetaWeblogApi 
    6868   
     
    135135      end 
    136136    end 
    137      
    138     article.send_pings(controller.url_for("/articles/read/#{article.id}"), struct['mt_tb_ping_urls']) 
     137 
     138    article.send_pings(controller.url_for(:controller => "/articles/read/#{article.id}"), struct['mt_tb_ping_urls']) 
    139139     
    140140    article.save 
     
    194194    end 
    195195 
    196     article.send_pings(controller.url_for("/articles/read/#{article.id}"), struct['mt_tb_ping_urls']) 
     196    article.send_pings(controller.url_for(:controller => "/articles/read/#{article.id}"), struct['mt_tb_ping_urls']) 
    197197 
    198198    article.save     
     
    214214    resource.save 
    215215       
    216     MetaWeblogStructs::Url.new("url" => controller.url_for("/files/#{data["name"]}")) 
     216    MetaWeblogStructs::Url.new("url" => controller.url_for(:controller => "/files/#{data["name"]}")) 
    217217  end              
    218218 
    219219  def article_dto_from(article) 
     220    # FIXME: rescue is needed for functional tests as the test framework currently doesn't supply fully fledged controller instances 
     221    article_url = controller.url_for :controller => "/articles/read/#{article.id}" rescue "/articles/read/#{article.id}" 
     222 
    220223    MetaWeblogStructs::Article.new( 
    221224      :description       => article.body, 
    222225      :title             => article.title, 
    223226      :postid            => article.id.to_s, 
    224       :url               => controller.url_for("/articles/read/#{article.id}")
    225       :link              => controller.url_for("/articles/read/#{article.id}")
    226       :permaLink         => controller.url_for("/articles/read/#{article.id}")
     227      :url               => article_url
     228      :link              => article_url
     229      :permaLink         => article_url
    227230      :categories        => article.categories.collect { |c| c.name }, 
    228231      :mt_text_more      => article.extended.to_s, 
     
    253256    end 
    254257  end 
    255  
    256   # FIXME: This method can be rewritten using API::Method#expects_index_of and API::Method#expects_to_hash 
    257   #       available in the next Rails release 
    258   def authenticate(name, args) 
    259     method_expects = self.class.web_service_api.api_methods[name][:expects] 
    260     username, password = method_expects.index(:username=>String), method_expects.index(:password=>String) 
    261  
    262     raise "Invalid login" unless User.authenticate?(args[username], args[password]) 
    263   end 
    264  
    265258end 
  • trunk/app/apis/moveable_type_service.rb

    r172 r173  
    11module MoveableTypeStructs 
    22  class ArticleTitle < ActionWebService::Struct 
    3     member :dateCreated,  :string 
    4     member :userid,       :string 
    5     member :postid,       :string 
     3    member :dateCreated,  :datetime 
     4    member :userid,       :int 
     5    member :postid,       :int 
    66    member :title,        :string 
    77  end 
     
    6363 
    6464 
    65 class MoveableTypeService < ActionWebService::Bas
     65class MoveableTypeService < TypoWebServic
    6666  web_service_api MoveableTypeApi 
    6767   
     
    154154    time.strftime "%a, %e %b %Y %H:%M:%S %Z" 
    155155  end 
    156  
    157   # FIXME: This method can be rewritten using API::Method#expects_index_of and API::Method#expects_to_hash 
    158   #       available in the next Rails release 
    159   def authenticate(name, args) 
    160     method_expects = self.class.web_service_api.api_methods[name][:expects] 
    161     username, password = method_expects.index(:username=>String), method_expects.index(:password=>String) 
    162  
    163     raise "Invalid login" unless User.authenticate?(args[username], args[password])     
    164   end 
    165156end