From a4b553d19583b82802689ed5342fb2122877ae20 Mon Sep 17 00:00:00 2001 From: "Gun.io Whitespace Robot" Date: Sat, 29 Oct 2011 03:30:36 -0400 Subject: [PATCH] Remove whitespace [Gun.io WhitespaceBot] --- .gitignore | 20 ++++ TODO | 2 +- app/api/deliverable_api.rb | 8 +- app/api/information_api.rb | 2 +- app/api/issue_api.rb | 30 ++--- app/api/project_api.rb | 10 +- app/api/project_based_api.rb | 2 +- app/controllers/base_service.rb | 6 +- app/controllers/deliverable_service.rb | 16 +-- app/controllers/information_service.rb | 8 +- app/controllers/issue_service.rb | 106 +++++++++--------- app/controllers/priority_service.rb | 4 +- app/controllers/project_based_service.rb | 12 +- app/controllers/project_service.rb | 40 +++---- .../redmine_webservice_controller.rb | 6 +- app/controllers/status_service.rb | 2 +- app/struct/attachment_dto.rb | 6 +- app/struct/boolean_dto.rb | 4 +- app/struct/custom_value_dto.rb | 2 +- app/struct/deliverable_dto.rb | 4 +- app/struct/issue_category_dto.rb | 2 +- app/struct/issue_custom_field_dto.rb | 2 +- app/struct/issue_dto.rb | 4 +- app/struct/issue_relation_dto.rb | 2 +- app/struct/issue_status_dto.rb | 2 +- app/struct/journal_dto.rb | 6 +- app/struct/member_dto.rb | 6 +- app/struct/project_dto.rb | 6 +- app/struct/query_dto.rb | 6 +- app/struct/version_dto.rb | 6 +- lib/query_string_decoder.rb | 20 ++-- 31 files changed, 186 insertions(+), 166 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ac8f968 --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +# Compiled source # +################### +*.com +*.class +*.dll +*.exe +*.o +*.so +*.pyc + +# Logs and databases # +###################### +*.log + +# OS generated files # +###################### +.DS_Store* +ehthumbs.db +Icon? +Thumbs.db diff --git a/TODO b/TODO index 001e33a..6bb2eeb 100644 --- a/TODO +++ b/TODO @@ -9,7 +9,7 @@ * Authentification des utilisateurs * Gestion des droits ---- Version 0.0.4 --- +--- Version 0.0.4 --- * Refactor for by logged user queries. diff --git a/app/api/deliverable_api.rb b/app/api/deliverable_api.rb index 2c042f8..c98668f 100644 --- a/app/api/deliverable_api.rb +++ b/app/api/deliverable_api.rb @@ -3,16 +3,16 @@ # Redmine Webservice - Yohann Monnier - Internethic * # * #**************************************************** - + require File.dirname(__FILE__) + '/../struct/deliverable_dto' class DeliverableApi < ActionWebService::API::Base - + api_method :find_deliverable_by_id, :expects => [:int], :returns => [DeliverableDto] - + api_method :create_deliverable_for_project, :expects => [:string,:string,:string], :returns => [DeliverableDto] @@ -24,7 +24,7 @@ class DeliverableApi < ActionWebService::API::Base api_method :delete_deliverable_for_project, :expects => [:int], :returns => [DeliverableDto] - + api_method :find_deliverables_for_project, :expects => [:string], :returns => [[DeliverableDto]] diff --git a/app/api/information_api.rb b/app/api/information_api.rb index b1cfa65..7a06ec2 100644 --- a/app/api/information_api.rb +++ b/app/api/information_api.rb @@ -11,5 +11,5 @@ class InformationApi < ActionWebService::API::Base api_method :check_credentials, :expects => [:string, :string], :returns => [:bool] - + end diff --git a/app/api/issue_api.rb b/app/api/issue_api.rb index d1ccaf4..0cd3822 100644 --- a/app/api/issue_api.rb +++ b/app/api/issue_api.rb @@ -3,7 +3,7 @@ # Redmine Webservice - Yohann Monnier - Internethic * # * #**************************************************** - + require File.dirname(__FILE__) + '/../struct/issue_dto' require File.dirname(__FILE__) + '/../struct/issue_status_dto' require File.dirname(__FILE__) + '/../struct/journal_dto' @@ -14,7 +14,7 @@ class IssueApi < ActionWebService::API::Base api_method :find_ticket_by_id, :expects => [:int], :returns => [IssueDto] - + api_method :find_allowed_statuses_for_issue, :expects => [:int], :returns => [[IssueStatusDto]] @@ -30,7 +30,7 @@ class IssueApi < ActionWebService::API::Base api_method :search_tickets, :expects => [:string, :int, :int], :returns => [[IssueDto]] - + api_method :find_tickets_by_last_update, :expects => [:int, :datetime], :returns => [[:int]] @@ -38,7 +38,7 @@ class IssueApi < ActionWebService::API::Base api_method :find_relations_for_issue, :expects => [:int], :returns => [[IssueRelationDto]] - + api_method :create_issue_for_project, :expects => [:string,:string,:string,:string,:string,:string,:string,:string,:string,:string,:int,:string,:string], :returns => [IssueDto] @@ -50,35 +50,35 @@ class IssueApi < ActionWebService::API::Base api_method :delete_issue_for_project, :expects => [:int], :returns => [IssueDto] - + api_method :find_issue_for_project, :expects => [:int], :returns => [[IssueDto]] - + api_method :add_time_entry_for_ticket, :expects => [:int, :string, :string, :string, :int], :returns => [IssueDto] - + api_method :add_comment_for_ticket, :expects => [:int, :string, :string], :returns => [IssueDto] - + api_method :find_issue_for_project2, :expects => [:string], :returns => [[IssueDto]] - + api_method :find_issue_for_user, :expects => [:string], :returns => [[IssueDto]] - + api_method :find_issue_for_user_by_project, :expects => [:string, :string], - :returns => [[IssueDto]] - + :returns => [[IssueDto]] + #api_method :assign_issue_to_user, # :expects => [:int, :string, :string], # :returns => [IssueDto] - - - + + + end diff --git a/app/api/project_api.rb b/app/api/project_api.rb index 96730ff..555a72b 100644 --- a/app/api/project_api.rb +++ b/app/api/project_api.rb @@ -3,7 +3,7 @@ # Redmine Webservice - Yohann Monnier - Internethic * # * #**************************************************** - + require File.dirname(__FILE__) + '/../struct/project_dto' require File.dirname(__FILE__) + '/../struct/boolean_dto' @@ -11,18 +11,18 @@ class ProjectApi < ActionWebService::API::Base api_method :find_all, :returns => [[ProjectDto]] - + api_method :find_one_project, :expects => [:string], :returns => [ProjectDto] - + api_method :create_one_project, :expects => [:string, :string, :string], :returns => [ProjectDto] api_method :update_one_project, :expects => [:string, :string, :string], - :returns => [ProjectDto] + :returns => [ProjectDto] + - end diff --git a/app/api/project_based_api.rb b/app/api/project_based_api.rb index 9aafd16..fcfb475 100644 --- a/app/api/project_based_api.rb +++ b/app/api/project_based_api.rb @@ -16,7 +16,7 @@ class ProjectBasedApi < ActionWebService::API::Base api_method :get_trackers_for_project, :expects => [:int], :returns => [[TrackerDto]] - + api_method :get_issue_categorys_for_project, :expects => [:int], :returns => [[IssueCategoryDto]] diff --git a/app/controllers/base_service.rb b/app/controllers/base_service.rb index 7090fc5..199b99b 100644 --- a/app/controllers/base_service.rb +++ b/app/controllers/base_service.rb @@ -13,7 +13,7 @@ class BaseService < ActionWebService::Base def initialize super @@authorizemap = Hash.new(nil) - + @@authorizemap[IssueService] = Hash.new(nil) @@authorizemap[IssueService][:find_ticket_by_id] = {:ctrl => :issues, :action => :show} @@authorizemap[IssueService][:find_allowed_statuses_for_issue] = {:ctrl => :issues, :action => :show} @@ -23,7 +23,7 @@ def initialize @@authorizemap[IssueService][:find_tickets_by_last_update] = {:ctrl => :issues, :action => :show} @@authorizemap[IssueService][:find_relations_for_issue] = {:ctrl => :issues, :action => :show} @@authorizemap[IssueService][:delete_ticket_for_project] = {:ctrl => :issues, :action => :show} - + @@authorizemap[ProjectBasedService] = Hash.new(nil) @@authorizemap[ProjectBasedService][:get_trackers_for_project] = {:ctrl => :issues, :action => :index} @@authorizemap[ProjectBasedService][:get_issue_categorys_for_project] = {:ctrl => :issues, :action => :index} @@ -31,7 +31,7 @@ def initialize @@authorizemap[ProjectBasedService][:get_versions_for_project] = {:ctrl => :issues, :action => :index} @@authorizemap[ProjectBasedService][:get_statuses_for_project] = {:ctrl => :issues, :action => :index} @@authorizemap[ProjectBasedService][:get_issue_custom_fields_for_project] = {:ctrl => :issues, :action => :index} - @@authorizemap[ProjectBasedService][:get_queries_for_project] = {:ctrl => :issues, :action => :index} + @@authorizemap[ProjectBasedService][:get_queries_for_project] = {:ctrl => :issues, :action => :index} end def find_project rpcname, args diff --git a/app/controllers/deliverable_service.rb b/app/controllers/deliverable_service.rb index 071cf28..9ea37dc 100644 --- a/app/controllers/deliverable_service.rb +++ b/app/controllers/deliverable_service.rb @@ -19,7 +19,7 @@ def find_project rpcname, args @project = @deliverable.project end end - + def find_deliverable_by_id id dto = DeliverableDto.create(@deliverable) @@ -36,13 +36,13 @@ def create_deliverable_for_project (project_identifier, deliverable_subject, del deliverable.project = @project # Save the deliverable deliverable.save - + dto = DeliverableDto.create(deliverable) return dto end - - def update_deliverable_for_project (id_deliverable, deliverable_subject, deliverable_fixed_cost) + + def update_deliverable_for_project (id_deliverable, deliverable_subject, deliverable_fixed_cost) # setting the subject @deliverable.subject = deliverable_subject @@ -50,18 +50,18 @@ def update_deliverable_for_project (id_deliverable, deliverable_subject, deliver @deliverable.fixed_cost = deliverable_fixed_cost # Save the deliverable @deliverable.save - + dto = DeliverableDto.create(@deliverable) return dto end - + def delete_deliverable_for_project id dto = DeliverableDto.create(@deliverable) return dto end - + def find_deliverables_for_project project_identifier if @project id_project = @project.id @@ -72,5 +72,5 @@ def find_deliverables_for_project project_identifier deliverables.collect! {|x|DeliverableDto.create(x)} return deliverables.compact end - + end diff --git a/app/controllers/information_service.rb b/app/controllers/information_service.rb index 4af065f..7b245d2 100644 --- a/app/controllers/information_service.rb +++ b/app/controllers/information_service.rb @@ -7,13 +7,13 @@ require File.dirname(__FILE__) + '/../api/information_api' class InformationService < ActionWebService::Base - + web_service_api InformationApi - + def get_version return Array.[](Redmine::VERSION, RAILS_GEM_VERSION, Redmine::Plugin.registered_plugins[:redmine_webservice].version) end - + def check_credentials username, password if User.try_to_login(username, password); true @@ -21,5 +21,5 @@ def check_credentials username, password false end end - + end diff --git a/app/controllers/issue_service.rb b/app/controllers/issue_service.rb index c9e261a..4a7c106 100644 --- a/app/controllers/issue_service.rb +++ b/app/controllers/issue_service.rb @@ -36,18 +36,18 @@ def find_project rpcname, args end def create_issue_for_project (project_identifier, task_subject, task_description,task_tracker,task_priority, task_created_on, task_updated_on, task_start_date, task_due_date, task_estimated_hours, deliverable_identifier, user_identifier, user_role) - + # number of estimated hours str_estimated_hours = task_estimated_hours # Priority of the task priorities = Enumeration.get_values('IPRI') default_priority = priorities[0] task_priority = default_priority unless task_priority = priorities[task_priority.to_i()] - + # finding tracker attribute - #tracker_to_be_assign = nil - tracker_to_be_assign = @project.trackers.find(:first); - all_project_tracker = @project.trackers.find(:all); + #tracker_to_be_assign = nil + tracker_to_be_assign = @project.trackers.find(:first); + all_project_tracker = @project.trackers.find(:all); all_project_tracker.each do |tracker| if task_tracker == tracker.name tracker_to_be_assign = tracker @@ -57,7 +57,7 @@ def create_issue_for_project (project_identifier, task_subject, task_description i = Issue.new :project => @project, :subject => task_subject[0, limit_for(Issue, 'subject')], - :description => task_description[0, limit_for(Issue, 'subject')], + :description => task_description[0, limit_for(Issue, 'subject')], :priority => task_priority, :created_on => Time.parse(task_start_date), :updated_on => Time.parse(task_start_date), @@ -69,7 +69,7 @@ def create_issue_for_project (project_identifier, task_subject, task_description i.status = IssueStatus.default i.tracker = tracker_to_be_assign # for this version the author of the task is always the webservice user - #####i.author = find_or_create_user @@projectManager, @project, @@price_per_hour_of_projectManager , @@role_of_projectManager + #####i.author = find_or_create_user @@projectManager, @project, @@price_per_hour_of_projectManager , @@role_of_projectManager i.author = User.current ## Recording the issue ##-------------------- @@ -86,18 +86,18 @@ def create_issue_for_project (project_identifier, task_subject, task_description end end - # Manage issue assignation + # Manage issue assignation if user_identifier assign_issue_to_user(i, user_identifier,user_role) end - + dto = IssueDto.create(i) complete_dto(i, dto) return dto end - - def update_issue_for_project (id_issue, task_name, task_description,task_priority, task_start_date, task_due_date, task_estimated_hours, update_note, done_ratio, deliverable_identifier, user_identifier, user_role) + + def update_issue_for_project (id_issue, task_name, task_description,task_priority, task_start_date, task_due_date, task_estimated_hours, update_note, done_ratio, deliverable_identifier, user_identifier, user_role) notes = update_note journal = @issue.init_journal(User.current, notes) @@ -111,7 +111,7 @@ def update_issue_for_project (id_issue, task_name, task_description,task_priorit # Priority of the task priorities = Enumeration.get_values('IPRI') task_priority = @issue.priority unless task_priority = priorities[task_priority.to_i()] - + if ( @issue.priority != task_priority ) @issue.priority = task_priority end @@ -124,17 +124,17 @@ def update_issue_for_project (id_issue, task_name, task_description,task_priorit if (((@issue.due_date.yday) != Time.parse(task_due_date).yday) or ((@issue.due_date.year) != Time.parse(task_due_date).year)) @issue.due_date = Date.parse(task_due_date) end - - # Manage issue assignation + + # Manage issue assignation if user_identifier assign_issue_to_user(@issue, user_identifier,user_role) end - + # Manage done ratio - if done_ratio != @issue.done_ratio + if done_ratio != @issue.done_ratio @issue.done_ratio = done_ratio - end - + end + # Manage Deliverable relation if deliverable_identifier != 0 deliverable = Deliverable.find_by_id(deliverable_identifier) @@ -147,7 +147,7 @@ def update_issue_for_project (id_issue, task_name, task_description,task_priorit end end end - + ## Recording the issue @issue.save @@ -155,13 +155,13 @@ def update_issue_for_project (id_issue, task_name, task_description,task_priorit complete_dto(@issue, dto) return dto end - + def delete_issue_for_project id dto = IssueDto.create(@issue) complete_dto(@issue, dto) return dto end - + def find_issue_for_project projectid issues = Issue.find(:all, :conditions => ["project_id = ? ", @project.id]) issues.collect! {|x|complete_dto(x, IssueDto.create(x))} @@ -173,26 +173,26 @@ def find_issue_for_project2 projectidentifier issues.collect! {|x|complete_dto(x, IssueDto.create(x))} return issues end - + def find_issue_for_user userlogin issues = Issue.find(:all, :include => [:project, :status,], :conditions => ["assigned_to_id = ? AND #{IssueStatus.table_name}.is_closed=?", @user.id, false]) issues.collect! {|x|complete_dto(x, IssueDto.create(x))} return issues end - - def find_issue_for_user_by_project project_id, userlogin + + def find_issue_for_user_by_project project_id, userlogin issues = Issue.find(:all, :include => [:project, :status,], :conditions => ["assigned_to_id = ? AND #{IssueStatus.table_name}.is_closed=? AND project_id = ? ", @user.id, false, @project.id]) issues.collect! {|x|complete_dto(x, IssueDto.create(x))} return issues end - - + + def find_ticket_by_id(id) dto = IssueDto.create(@issue) complete_dto(@issue, dto) return dto end - + def add_time_entry_for_ticket(task_id, user_identifier, spent_time, comments, write_comment) # retrieve user worker_user = User.find_by_login(user_identifier) @@ -213,22 +213,22 @@ def add_time_entry_for_ticket(task_id, user_identifier, spent_time, comments, wr if time_entry.valid? time_entry.save end - + # prepare comment #if ( write_comment == 1 ) # notes = comments # journal = @issue.init_journal(worker_user, comments) #end - + ## Recording the issue #@issue.save - + dto = IssueDto.create(@issue) complete_dto(@issue, dto) return dto end - + def add_comment_for_ticket(task_id, user_identifier, comments) # retrieve user worker_user = User.find_by_login(user_identifier) @@ -237,36 +237,36 @@ def add_comment_for_ticket(task_id, user_identifier, comments) journal = @issue.init_journal(worker_user, comments) ## Recording the issue @issue.save - + dto = IssueDto.create(@issue) complete_dto(@issue, dto) return dto end - + def find_allowed_statuses_for_issue(id) statuses = @issue.new_statuses_allowed_to(User.current) - - if !statuses.include?(@issue.status) + + if !statuses.include?(@issue.status) statuses.unshift(@issue.status); end - + statuses.collect! {|x|IssueStatusDto.create(x)} return statuses.compact end - + def find_journals_for_issue(id) journals = @issue.journals.find(:all, :conditions => ["notes IS NOT NULL"]) journals.collect! {|x|JournalDto.create(x)} return journals.compact end - + def find_attachments_for_issue(id) attachments = @issue.attachments attachments.collect! {|x|AttachmentDto.create(x)} return attachments end - - + + def assign_issue_to_user (issue, user_identifier, user_role) #def assign_issue_to_user (issue_id, user_identifier, user_role) if issue @@ -278,7 +278,7 @@ def assign_issue_to_user (issue, user_identifier, user_role) if user_to_be_assigned # if the user is not member of the project, we add him if !user_to_be_assigned.member_of?(project) - + # searching the role given by the webservice User role_in_project = Role.find(:first, :conditions => ["name = ?", user_role]) # if no role is found we will give him this role @@ -289,11 +289,11 @@ def assign_issue_to_user (issue, user_identifier, user_role) Member.create(:user => user_to_be_assigned, :project => project, :role => role_in_project) # TODO : # #, :rate => price_per_hour) - - # we reload user right + + # we reload user right user_to_be_assigned.reload end - + issue.assigned_to = user_to_be_assigned #issue.save end @@ -302,7 +302,7 @@ def assign_issue_to_user (issue, user_identifier, user_role) #complete_dto(@issue, dto) #return dto end - + def search_tickets(query_string, project_id, query_id) if @query.valid? @@ -315,7 +315,7 @@ def search_tickets(query_string, project_id, query_id) nil end end - + def find_tickets_by_last_update(projectid, timestamp) issues = Issue.find(:all, :conditions => ["project_id = ? AND updated_on >= ?", projectid, timestamp]) issues.collect! {|x|x.id} @@ -327,7 +327,7 @@ def find_relations_for_issue id relations.collect! {|x|IssueRelationDto.create(x)} return relations.compact end - + private def retrieve_query query_string, project_id, query_id query = nil @@ -359,7 +359,7 @@ def complete_dto issue, dto statuses.collect! {|x|IssueStatusDto.create(x)} dto.all_status = statuses.compact - + #journals = issue.journals.find(:all, :conditions => ["notes IS NOT NULL"]) #journals.collect! {|x|JournalDto.create(x)} #dto.all_journals = journals.compact @@ -367,7 +367,7 @@ def complete_dto issue, dto #attachments = issue.attachments #attachments.collect! {|x|AttachmentDto.create(x)} #dto.all_attachments = attachments.compact - + project = issue.project if project dto.project_name = project.name @@ -382,16 +382,16 @@ def complete_dto issue, dto dto.priority = priorite.to_s() end end - + relations = issue.relations relations.collect! {|x|IssueRelationDto.create(x)} dto.all_relations = relations.compact return dto end - + def limit_for(klass, attribute) klass.columns_hash[attribute.to_s].limit - end - + end + end diff --git a/app/controllers/priority_service.rb b/app/controllers/priority_service.rb index 91eba0a..6a3b35e 100644 --- a/app/controllers/priority_service.rb +++ b/app/controllers/priority_service.rb @@ -9,11 +9,11 @@ class PriorityService < ActionWebService::Base web_service_api PriorityApi - + def get_all enumerations = Enumeration::get_values('IPRI') prioritys = Array.new(enumerations.size) - enumerations.each { |element| + enumerations.each { |element| prioritys.push(PriorityDto.create(element)) } end diff --git a/app/controllers/project_based_service.rb b/app/controllers/project_based_service.rb index 62d50f2..cfaafaf 100644 --- a/app/controllers/project_based_service.rb +++ b/app/controllers/project_based_service.rb @@ -24,21 +24,21 @@ def find_project rpcname, args def get_trackers_for_project id tmp = @project.trackers.find(:all); trackers = Array.new(tmp.size) - tmp.each { |element| + tmp.each { |element| trackers.push(TrackerDto.create(element)) } end - + def get_issue_custom_fields_for_project id custom_fields = @project.methods.include?('all_issue_custom_fields') ? @project.all_issue_custom_fields : @project.all_custom_fields; custom_fields.collect! { |x| IssueCustomFieldDto.create(x) } return custom_fields.compact end - + def get_issue_categorys_for_project id tmp = @project.issue_categories categorys = Array.new(tmp.size) - tmp.each { |element| + tmp.each { |element| categorys.push(IssueCategoryDto.create(element)) } end @@ -65,7 +65,7 @@ def get_queries_for_project id queries.collect!{|x|QueryDto.create(x)} return queries.compact end - + def find_or_create_user(username, user_mail, project=nil, price_per_hour = nil , role_per_group = nil) u = User.find_by_login(username) if !u @@ -88,7 +88,7 @@ def find_or_create_user(username, user_mail, project=nil, price_per_hour = nil , end end # Make sure he is a member of the project - if project + if project # assigning default role, if a role is defined then this role will be the one assigned role = @@DEFAULT_ROLE #if role_per_group diff --git a/app/controllers/project_service.rb b/app/controllers/project_service.rb index a85d198..8f1b05f 100644 --- a/app/controllers/project_service.rb +++ b/app/controllers/project_service.rb @@ -11,15 +11,15 @@ class ProjectService < ActionWebService::Base web_service_api ProjectApi - - def find_all + + def find_all projects = Project.find(:all, :joins => :enabled_modules, :conditions => [ "enabled_modules.name = 'issue_tracking' AND #{Project.visible_by}"]) projects.collect! {|x|ProjectDto.create(x)} return projects end - + def find_one_project(projectIdentifier) # retrieving project project = Project.find_by_identifier(projectIdentifier, :conditions => [ "#{Project.visible_by}"]) @@ -32,18 +32,18 @@ def find_one_project(projectIdentifier) dto_Project = nil end end - + def create_one_project(projectIdentifier, projectName, projectDescription) # check user right if User.current.admin? # I look for a project with this identifier project = Project.find_by_identifier(projectIdentifier) - + boo_NewProject = false boo_SavedProject = false - + if !project - + # Create the new project project = Project.new :name => projectName, :description => projectDescription, @@ -56,7 +56,7 @@ def create_one_project(projectIdentifier, projectName, projectDescription) allTrackersCollection = Tracker.find(:all) allTrackersCollection.each do |tracker| project.trackers << tracker - end + end # Save the new project if (project.save) boo_SavedProject = true @@ -68,20 +68,20 @@ def create_one_project(projectIdentifier, projectName, projectDescription) else boo_SavedProject = false boo_NewProject = false - end - + end + dto_Project = ProjectDto.createAndReturn(project,boo_SavedProject,boo_NewProject) - return dto_Project + return dto_Project else return nil end end - + def update_one_project(projectIdentifier, projectName, projectDescription) project = Project.find_by_identifier(projectIdentifier, :conditions => [ "#{Project.visible_by}"]) - + boo_NewProject = false - + if !project return nil elsif !User.current.allowed_to?({:controller => "projects", :action => "edit"} , project) @@ -91,20 +91,20 @@ def update_one_project(projectIdentifier, projectName, projectDescription) project.name = projectName project.description = projectDescription project.is_public = 0 - + # Update this project if (project.save) boo_SavedProject = true else boo_SavedProject = false end - end - + end + dto_Project = ProjectDto.createAndReturn(project,boo_SavedProject,boo_NewProject) - - return dto_Project + + return dto_Project end - + end diff --git a/app/controllers/redmine_webservice_controller.rb b/app/controllers/redmine_webservice_controller.rb index 25e1d82..474980a 100644 --- a/app/controllers/redmine_webservice_controller.rb +++ b/app/controllers/redmine_webservice_controller.rb @@ -6,9 +6,9 @@ class RedmineWebserviceController < ActionController::Base before_filter :authenticate - + web_service_dispatching_mode :layered - + web_service :Project, ProjectService.new web_service :Ticket, IssueService.new web_service :Information, InformationService.new @@ -16,7 +16,7 @@ class RedmineWebserviceController < ActionController::Base web_service :Priority, PriorityService.new web_service :ProjectBased, ProjectBasedService.new web_service :Status, StatusService.new - + def authenticate if params[:methodCall] && params[:methodCall][:methodName] && params[:methodCall][:methodName].include?('Information.') return true; diff --git a/app/controllers/status_service.rb b/app/controllers/status_service.rb index b045edc..6feada2 100644 --- a/app/controllers/status_service.rb +++ b/app/controllers/status_service.rb @@ -9,7 +9,7 @@ class StatusService < ActionWebService::Base web_service_api StatusApi - + def get_all statuses = IssueStatus.find(:all) statuses.collect!{|x|IssueStatusDto.create(x)} diff --git a/app/struct/attachment_dto.rb b/app/struct/attachment_dto.rb index c7bb6a1..8ea0ec9 100644 --- a/app/struct/attachment_dto.rb +++ b/app/struct/attachment_dto.rb @@ -1,7 +1,7 @@ -# +# # To change this template, choose Tools | Templates # and open the template in the editor. - + # 1 # 6 # Issue @@ -26,7 +26,7 @@ class AttachmentDto < ActionWebService::Struct member :digest, :string member :content_type, :string member :description, :string - + def AttachmentDto.create attachment AttachmentDto.new( :id => attachment.id, diff --git a/app/struct/boolean_dto.rb b/app/struct/boolean_dto.rb index a9ed299..d7a5a5e 100644 --- a/app/struct/boolean_dto.rb +++ b/app/struct/boolean_dto.rb @@ -2,9 +2,9 @@ class BooleanDto < ActionWebService::Struct member :validate, :string - + def self.create booleanAnswer return BooleanDto.new(:validate => booleanAnswer) end - + end diff --git a/app/struct/custom_value_dto.rb b/app/struct/custom_value_dto.rb index 7d3ccbc..35ecaae 100644 --- a/app/struct/custom_value_dto.rb +++ b/app/struct/custom_value_dto.rb @@ -2,7 +2,7 @@ class CustomValueDto < ActionWebService::Struct member :custom_field_id, :int member :value, :string - + def self.create value CustomValueDto.new( :custom_field_id => value.custom_field_id, diff --git a/app/struct/deliverable_dto.rb b/app/struct/deliverable_dto.rb index df8d147..713ee9b 100644 --- a/app/struct/deliverable_dto.rb +++ b/app/struct/deliverable_dto.rb @@ -5,9 +5,9 @@ class DeliverableDto < ActionWebService::Struct member :subject, :string member :fixed_cost, :string - + def self.create deliverable - + return DeliverableDto.new( :id => deliverable.id, :project_id => deliverable.project_id, diff --git a/app/struct/issue_category_dto.rb b/app/struct/issue_category_dto.rb index c5cc463..c2273e6 100644 --- a/app/struct/issue_category_dto.rb +++ b/app/struct/issue_category_dto.rb @@ -5,7 +5,7 @@ class IssueCategoryDto < ActionWebService::Struct # member :id, :int member :name, :string - + def IssueCategoryDto.create category IssueCategoryDto.new( :id => category.id, diff --git a/app/struct/issue_custom_field_dto.rb b/app/struct/issue_custom_field_dto.rb index 08b6c2f..e913dfe 100644 --- a/app/struct/issue_custom_field_dto.rb +++ b/app/struct/issue_custom_field_dto.rb @@ -11,7 +11,7 @@ class IssueCustomFieldDto < ActionWebService::Struct member :is_filter, :boolean member :possible_values, [:string] member :trackers, [:int] - + def self.create field IssueCustomFieldDto.new( :id => field.id, diff --git a/app/struct/issue_dto.rb b/app/struct/issue_dto.rb index f365c26..bbe1690 100644 --- a/app/struct/issue_dto.rb +++ b/app/struct/issue_dto.rb @@ -28,12 +28,12 @@ class IssueDto < ActionWebService::Struct member :all_journals, [JournalDto] member :all_attachments, [AttachmentDto] member :all_relations, [IssueRelationDto] - + def self.create issue custom_values = issue.custom_values custom_values.collect! { |x| CustomValueDto.create(x)} custom_values.compact! - + return IssueDto.new( :id => issue.id, :project_id => issue.project_id, diff --git a/app/struct/issue_relation_dto.rb b/app/struct/issue_relation_dto.rb index 609bada..8ab7e37 100644 --- a/app/struct/issue_relation_dto.rb +++ b/app/struct/issue_relation_dto.rb @@ -4,7 +4,7 @@ class IssueRelationDto < ActionWebService::Struct member :to, :int member :type, :string member :delay, :int - + def IssueRelationDto.create relation IssueRelationDto.new( :id => relation.id, diff --git a/app/struct/issue_status_dto.rb b/app/struct/issue_status_dto.rb index f302aa4..88851e3 100644 --- a/app/struct/issue_status_dto.rb +++ b/app/struct/issue_status_dto.rb @@ -8,7 +8,7 @@ class IssueStatusDto < ActionWebService::Struct member :name, :string member :is_closed, :bool member :is_default, :bool - + def IssueStatusDto.create status IssueStatusDto.new( :id => status.id, diff --git a/app/struct/journal_dto.rb b/app/struct/journal_dto.rb index 2700510..79d2833 100644 --- a/app/struct/journal_dto.rb +++ b/app/struct/journal_dto.rb @@ -1,7 +1,7 @@ -# +# # To change this template, choose Tools | Templates # and open the template in the editor. - + class JournalDto < ActionWebService::Struct # 4 @@ -18,7 +18,7 @@ class JournalDto < ActionWebService::Struct member :notes, :string member :created_on, :datetime member :editable_by_user, :boolean - + def JournalDto.create journal if (journal.notes=='') return nil diff --git a/app/struct/member_dto.rb b/app/struct/member_dto.rb index 3c5fa9b..1403256 100644 --- a/app/struct/member_dto.rb +++ b/app/struct/member_dto.rb @@ -1,13 +1,13 @@ -# +# # To change this template, choose Tools | Templates # and open the template in the editor. - + class MemberDto < ActionWebService::Struct member :id, :int member :name, :string member :assignable, :bool - + def MemberDto.create member MemberDto.new( :id => member.user.id, diff --git a/app/struct/project_dto.rb b/app/struct/project_dto.rb index be9fd56..335d97d 100644 --- a/app/struct/project_dto.rb +++ b/app/struct/project_dto.rb @@ -7,7 +7,7 @@ class ProjectDto < ActionWebService::Struct member :issue_edit_allowed, :boolean member :project_saved, :boolean member :new_project, :boolean - + def self.create project ProjectDto.new( :id => project.id, @@ -17,8 +17,8 @@ def self.create project :issue_edit_allowed => User.current.allowed_to?(:edit_issues, project) ) end - - def self.createAndReturn(project,boo_saved,boo_new) + + def self.createAndReturn(project,boo_saved,boo_new) return ProjectDto.new( :id => project.id, :identifier => project.identifier, diff --git a/app/struct/query_dto.rb b/app/struct/query_dto.rb index 7540103..548beee 100644 --- a/app/struct/query_dto.rb +++ b/app/struct/query_dto.rb @@ -1,12 +1,12 @@ -# +# # To change this template, choose Tools | Templates # and open the template in the editor. - + class QueryDto < ActionWebService::Struct member :id, :int member :name, :string - + def QueryDto.create query QueryDto.new( :id => query.id, diff --git a/app/struct/version_dto.rb b/app/struct/version_dto.rb index dcd7e5e..e47c4d4 100644 --- a/app/struct/version_dto.rb +++ b/app/struct/version_dto.rb @@ -1,12 +1,12 @@ -# +# # To change this template, choose Tools | Templates # and open the template in the editor. - + class VersionDto < ActionWebService::Struct member :id, :int member :name, :string - + def VersionDto.create version VersionDto.new( :id => version.id, diff --git a/lib/query_string_decoder.rb b/lib/query_string_decoder.rb index 5deb81a..7777434 100644 --- a/lib/query_string_decoder.rb +++ b/lib/query_string_decoder.rb @@ -3,13 +3,13 @@ # Redmine Webservice - Yohann Monnier - Internethic * # * #****************************************************r. - + class QueryStringDecoder < ActionController::UrlEncodedPairParser def initialize(query_string) super(find_pairs(query_string)) # @result = to_symbols(@result) end - + def find_pairs(query_string) return {} if query_string.blank? @@ -20,10 +20,10 @@ def find_pairs(query_string) value = value.nil? ? nil : CGI.unescape(value) [ CGI.unescape(key), value ] end.compact - + return pairs end - + def to_symbols hash hash.each {|key, value| hash.delete(key) @@ -40,23 +40,23 @@ def to_symbols hash end } hash.store(key.to_sym, value) - + end } return hash - + end - + def project @project ||= Project.find(@result['project_id']) rescue nil end - + def query @query ||= build_query end - + def build_query query = Query.new(:name => "_") query.project = @project @@ -67,6 +67,6 @@ def build_query end return query end - + end