Changeset 173
- Timestamp:
- 04/13/05 20:21:27 (3 years ago)
- Files:
-
- trunk/app/apis/blogger_service.rb (modified) (2 diffs)
- trunk/app/apis/meta_weblog_service.rb (modified) (6 diffs)
- trunk/app/apis/moveable_type_service.rb (modified) (3 diffs)
- trunk/app/apis/typo_web_service.rb (copied) (copied from branches/spamprot/app/apis/typo_web_service.rb)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/app/apis/blogger_service.rb
r172 r173 21 21 22 22 23 class BloggerService < ActionWebService::Base23 class BloggerService < TypoWebService 24 24 web_service_api BloggerApi 25 25 … … 39 39 def getUsersBlogs(appkey, username, password) 40 40 [BloggerStructs::Blog.new( 41 :url => controller.url_for( "/"),41 :url => controller.url_for(:controller => "/"), 42 42 :blogid => 1, 43 43 :blogName => config['blog_name'] 44 44 )] 45 45 end 46 47 private48 49 # FIXME: This method can be rewritten using API::Method#expects_index_of and API::Method#expects_to_hash50 # available in the next Rails release51 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 end57 58 46 end trunk/app/apis/meta_weblog_service.rb
r172 r173 15 15 member :mt_convert_breaks, :string 16 16 member :mt_tb_ping_urls, :string 17 member :dateCreated, : string17 member :dateCreated, :datetime 18 18 end 19 19 … … 64 64 65 65 66 class MetaWeblogService < ActionWebService::Base66 class MetaWeblogService < TypoWebService 67 67 web_service_api MetaWeblogApi 68 68 … … 135 135 end 136 136 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']) 139 139 140 140 article.save … … 194 194 end 195 195 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']) 197 197 198 198 article.save … … 214 214 resource.save 215 215 216 MetaWeblogStructs::Url.new("url" => controller.url_for( "/files/#{data["name"]}"))216 MetaWeblogStructs::Url.new("url" => controller.url_for(:controller => "/files/#{data["name"]}")) 217 217 end 218 218 219 219 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 220 223 MetaWeblogStructs::Article.new( 221 224 :description => article.body, 222 225 :title => article.title, 223 226 :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, 227 230 :categories => article.categories.collect { |c| c.name }, 228 231 :mt_text_more => article.extended.to_s, … … 253 256 end 254 257 end 255 256 # FIXME: This method can be rewritten using API::Method#expects_index_of and API::Method#expects_to_hash257 # available in the next Rails release258 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 end264 265 258 end trunk/app/apis/moveable_type_service.rb
r172 r173 1 1 module MoveableTypeStructs 2 2 class ArticleTitle < ActionWebService::Struct 3 member :dateCreated, : string4 member :userid, : string5 member :postid, : string3 member :dateCreated, :datetime 4 member :userid, :int 5 member :postid, :int 6 6 member :title, :string 7 7 end … … 63 63 64 64 65 class MoveableTypeService < ActionWebService::Base65 class MoveableTypeService < TypoWebService 66 66 web_service_api MoveableTypeApi 67 67 … … 154 154 time.strftime "%a, %e %b %Y %H:%M:%S %Z" 155 155 end 156 157 # FIXME: This method can be rewritten using API::Method#expects_index_of and API::Method#expects_to_hash158 # available in the next Rails release159 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 end165 156 end
