Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi! I cleaned up your code for you! #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion TODO
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Authentification des utilisateurs
* Gestion des droits

--- Version 0.0.4 ---
--- Version 0.0.4 ---

* Refactor for by logged user queries.

Expand Down
8 changes: 4 additions & 4 deletions app/api/deliverable_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]]
Expand Down
2 changes: 1 addition & 1 deletion app/api/information_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ class InformationApi < ActionWebService::API::Base
api_method :check_credentials,
:expects => [:string, :string],
:returns => [:bool]

end
30 changes: 15 additions & 15 deletions app/api/issue_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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]]
Expand All @@ -30,15 +30,15 @@ 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]]

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]
Expand All @@ -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
10 changes: 5 additions & 5 deletions app/api/project_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@
# Redmine Webservice - Yohann Monnier - Internethic *
# *
#****************************************************

require File.dirname(__FILE__) + '/../struct/project_dto'
require File.dirname(__FILE__) + '/../struct/boolean_dto'

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
2 changes: 1 addition & 1 deletion app/api/project_based_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/base_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -23,15 +23,15 @@ 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}
@@authorizemap[ProjectBasedService][:get_members_for_project] = {:ctrl => :issues, :action => :index}
@@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
Expand Down
16 changes: 8 additions & 8 deletions app/controllers/deliverable_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def find_project rpcname, args
@project = @deliverable.project
end
end

def find_deliverable_by_id id
dto = DeliverableDto.create(@deliverable)

Expand All @@ -36,32 +36,32 @@ 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
# setting the cost
@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
Expand All @@ -72,5 +72,5 @@ def find_deliverables_for_project project_identifier
deliverables.collect! {|x|DeliverableDto.create(x)}
return deliverables.compact
end

end
8 changes: 4 additions & 4 deletions app/controllers/information_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
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
else
false
end
end

end
Loading