Class: Unfuddle

Inherits:
Object
  • Object
show all
Includes:
HasTickets
Defined in:
lib/unfuddle.rb,
lib/unfuddle/neq.rb,
lib/unfuddle/base.rb,
lib/unfuddle/error.rb,
lib/unfuddle/person.rb,
lib/unfuddle/ticket.rb,
lib/unfuddle/comment.rb,
lib/unfuddle/project.rb,
lib/unfuddle/version.rb,
lib/unfuddle/response.rb,
lib/unfuddle/severity.rb,
lib/unfuddle/component.rb,
lib/unfuddle/milestone.rb,
lib/unfuddle/has_tickets.rb,
lib/unfuddle/configuration.rb,
lib/unfuddle/ticket_report.rb,
lib/unfuddle/custom_field_value.rb

Defined Under Namespace

Modules: Error, HasTickets, NeqHelper Classes: Base, Comment, Component, Configuration, ConfigurationError, ConnectionError, CustomFieldValue, InvalidResponseError, Milestone, Neq, Person, Project, Response, ServerError, Severity, Ticket, TicketReport, TimeoutError, UnauthorizedError, UndefinedCustomField, UndefinedCustomFieldValue, UndefinedSeverity

Constant Summary collapse

VERSION =
"0.7.0"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HasTickets

#construct_ticket_query, #create_condition_string, #find_ticket_by_number, #find_tickets!, #prepare_key_and_value_for_conditions_string

Instance Attribute Details

#configurationObject

Returns the value of attribute configuration.



65
66
67
# File 'lib/unfuddle.rb', line 65

def configuration
  @configuration
end

Class Method Details

.assert_response!(expected_response_code, response) ⇒ Object



40
41
42
43
44
# File 'lib/unfuddle.rb', line 40

def assert_response!(expected_response_code, response)
  unless response.status == expected_response_code
    raise InvalidResponseError.new(response)
  end
end

.config(options = nil) {|configuration| ... } ⇒ Object

Yields:



19
20
21
22
23
24
# File 'lib/unfuddle.rb', line 19

def config(options=nil)
  configuration = Unfuddle::Configuration.new
  configuration.from_options(options) if options
  yield configuration if block_given?
  instance.configuration = configuration
end

.instanceObject



36
37
38
# File 'lib/unfuddle.rb', line 36

def instance
  @unfuddle ||= self.new
end

.with_config(options) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/unfuddle.rb', line 26

def with_config(options)
  current_configuration = instance.configuration
  begin
    config(current_configuration.merge(options))
    yield
  ensure
    instance.configuration = current_configuration
  end
end

Instance Method Details

#configured?Boolean

Returns:

  • (Boolean)


118
119
120
# File 'lib/unfuddle.rb', line 118

def configured?
  subdomain && username && password
end

#delete(path) ⇒ Object



112
113
114
# File 'lib/unfuddle.rb', line 112

def delete(path)
  http_send_with_logging :delete, path
end

#get(path) ⇒ Object



100
101
102
# File 'lib/unfuddle.rb', line 100

def get(path)
  http_send_with_logging :get, path
end

#people(options = {}) ⇒ Object



90
91
92
# File 'lib/unfuddle.rb', line 90

def people(options={})
  Unfuddle::Person.all(options)
end

#person(person_id) ⇒ Object



94
95
96
# File 'lib/unfuddle.rb', line 94

def person(person_id)
  Unfuddle::Person.new("id" => person_id)
end

#post(path, object) ⇒ Object



104
105
106
# File 'lib/unfuddle.rb', line 104

def post(path, object)
  http_send_with_logging :post, path, object.to_xml
end

#project(project_id) ⇒ Object



86
87
88
# File 'lib/unfuddle.rb', line 86

def project(project_id)
  Unfuddle::Project.new("id" => project_id)
end

#projectsObject



82
83
84
# File 'lib/unfuddle.rb', line 82

def projects
  Unfuddle.Project.all
end

#put(path, object) ⇒ Object



108
109
110
# File 'lib/unfuddle.rb', line 108

def put(path, object)
  http_send_with_logging :put, path, object.to_xml
end