Class: Assembla::Client::Spaces::Tickets

Inherits:
API
  • Object
show all
Defined in:
lib/assembla_api/client/spaces/tickets.rb

Defined Under Namespace

Classes: Associations, Comments, CustomFields, Statuses

Constant Summary collapse

VALID_PARAMS_NAMES =
%w[
  summary
  description
  priority
  component_id
  created_on
  permission_type
  is_story
  milestone_id
  tags
  followers
  notification_list
  status
  story_importance
  working_hours
  estimate
  assigned_to_id
  custom_fields
  hierarchy_type
  is_support
].freeze

Constants included from MimeType

MimeType::MEDIA_LOOKUP

Constants included from Assembla::Constants

Assembla::Constants::ACCEPT, Assembla::Constants::ACCEPTED_OAUTH_SCOPES, Assembla::Constants::ACCEPT_CHARSET, Assembla::Constants::CACHE_CONTROL, Assembla::Constants::CONTENT_LENGTH, Assembla::Constants::CONTENT_TYPE, Assembla::Constants::DATE, Assembla::Constants::ETAG, Assembla::Constants::HEADER_LAST, Assembla::Constants::HEADER_LINK, Assembla::Constants::HEADER_NEXT, Assembla::Constants::LOCATION, Assembla::Constants::META_FIRST, Assembla::Constants::META_LAST, Assembla::Constants::META_NEXT, Assembla::Constants::META_PREV, Assembla::Constants::META_REL, Assembla::Constants::OAUTH_SCOPES, Assembla::Constants::PARAM_PAGE, Assembla::Constants::PARAM_PER_PAGE, Assembla::Constants::PARAM_START_PAGE, Assembla::Constants::RATELIMIT_LIMIT, Assembla::Constants::RATELIMIT_REMAINING, Assembla::Constants::SERVER, Assembla::Constants::USER_AGENT

Instance Attribute Summary

Attributes inherited from API

#current_options

Attributes included from Authorization

#scopes

Instance Method Summary collapse

Methods inherited from API

after_callbacks, after_request, #api_methods_in, #arguments, before_callbacks, before_request, clear_request_methods!, #execute, extend_with_actions, extra_methods, extract_class_name, #filter_callbacks, inherited, #initialize, internal_methods, method_added, #method_missing, #module_methods_in, namespace, #process_basic_auth, request_methods, root!, #run_callbacks, #set, #setup, #with, #yield_or_eval

Methods included from Assembla::ClassMethods

#configuration, #configure, #require_all

Methods included from RateLimit

#ratelimit, #ratelimit_remaining, #ratelimit_reset

Methods included from Request::Verbs

#delete_request, #get_request, #head_request, #options_request, #patch_request, #post_request, #put_request

Methods included from MimeType

#lookup_media, #parse

Methods included from Authorization

#auth_code, #authenticated?, #authentication, #authorize_url, #basic_authed?, #client, #get_token

Constructor Details

This class inherits a constructor from Assembla::API

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Assembla::API

Instance Method Details

#attachments(*args) ⇒ Object

api.spaces.tickets.attachments ‘project1’, 14



129
130
131
132
133
134
# File 'lib/assembla_api/client/spaces/tickets.rb', line 129

def attachments(*args)
  arguments(args, required: [:space, :number])
  response = get_request("/spaces/#{arguments.space}/tickets/#{arguments.number}/attachments", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end

#by_milestone_id(*args) ⇒ Object

api.spaces.tickets.by_milestone_id ‘project1’, 49



111
112
113
114
115
116
# File 'lib/assembla_api/client/spaces/tickets.rb', line 111

def by_milestone_id(*args)
  arguments(args, required: [:space, :milestone_id])
  response = get_request("/spaces/#{arguments.space}/tickets/milestone/#{arguments.milestone_id}", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end

#create(*args) ⇒ Object

api.spaces.tickets.create ‘project1’, ticket: { summary: ‘First ticket’ }



39
40
41
42
43
44
45
46
47
# File 'lib/assembla_api/client/spaces/tickets.rb', line 39

def create(*args)
  arguments(args, required: [:space]) do
    permit VALID_PARAMS_NAMES, recursive: true
    assert_required %w[ summary ]
    # TODO assert_values VALID_REQUEST_PARAM_VALUES
  end

  post_request("/spaces/#{arguments.space}/tickets", arguments.params)
end

#custom_reports(*args) ⇒ Object

api.spaces.tickets.custom_reports ‘project1’



147
148
149
150
151
152
# File 'lib/assembla_api/client/spaces/tickets.rb', line 147

def custom_reports(*args)
  arguments(args, required: [:space])
  response = get_request("/spaces/#{arguments.space}/tickets/custom_reports", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end

#delete(*args) ⇒ Object

Delete ticket by number api.spaces.tickets.delete ‘project1’, 7



77
78
79
80
# File 'lib/assembla_api/client/spaces/tickets.rb', line 77

def delete(*args)
  arguments(args, required: [:space, :number])
  delete_request("/spaces/#{arguments.space}/tickets/#{arguments.number}", arguments.params)
end

#edit(*args) ⇒ Object

api.spaces.tickets.edit ‘project1’, 7, ticket: ‘REQ changed…’



65
66
67
68
69
70
71
72
# File 'lib/assembla_api/client/spaces/tickets.rb', line 65

def edit(*args)
  arguments(args, required: [:space, :number]) do
    permit VALID_PARAMS_NAMES , recursive: true
    # TODO assert_values VALID_REQUEST_PARAM_VALUES
  end

  put_request("/spaces/#{arguments.space}/tickets/#{arguments.number}", arguments.params)
end

#followed(*args) ⇒ Object

api.spaces.tickets.followed ‘project1’



102
103
104
105
106
107
# File 'lib/assembla_api/client/spaces/tickets.rb', line 102

def followed(*args)
  arguments(args, required: [:space])
  response = get_request("/spaces/#{arguments.space}/tickets/my_followed", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end

#get(*args) ⇒ Object

api.spaces.tickets.get ‘project1’, 7



51
52
53
54
# File 'lib/assembla_api/client/spaces/tickets.rb', line 51

def get(*args)
  arguments(args, required: [:space, :number])
  get_request("/spaces/#{arguments.space}/tickets/#{arguments.number}", arguments.params)
end

#get_by_id(*args) ⇒ Object

api.spaces.tickets.get_by_id ‘project1’, 1710



58
59
60
61
# File 'lib/assembla_api/client/spaces/tickets.rb', line 58

def get_by_id(*args)
  arguments(args, required: [:space, :ticket_id])
  get_request("/spaces/#{arguments.space}/tickets/id/#{arguments.ticket_id}", arguments.params)
end

#list(*args) ⇒ Object

api.spaces.tickets.list ‘project1’



84
85
86
87
88
89
# File 'lib/assembla_api/client/spaces/tickets.rb', line 84

def list(*args)
  arguments(args, required: [:space])
  response = get_request("/spaces/#{arguments.space}/tickets", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end

#my(*args) ⇒ Object

api.spaces.tickets.my ‘project1’



93
94
95
96
97
98
# File 'lib/assembla_api/client/spaces/tickets.rb', line 93

def my(*args)
  arguments(args, required: [:space])
  response = get_request("/spaces/#{arguments.space}/tickets/my_active", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end

#tags(*args) ⇒ Object

api.spaces.tickets.tags ‘project1’, 14



138
139
140
141
142
143
# File 'lib/assembla_api/client/spaces/tickets.rb', line 138

def tags(*args)
  arguments(args, required: [:space, :number])
  response = get_request("/spaces/#{arguments.space}/tickets/#{arguments.number}/tags", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end

#without_milestone(*args) ⇒ Object

api.spaces.tickets.by_milestone_id ‘project1’



120
121
122
123
124
125
# File 'lib/assembla_api/client/spaces/tickets.rb', line 120

def without_milestone(*args)
  arguments(args, required: [:space])
  response = get_request("/spaces/#{arguments.space}/tickets/no_milestone", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end