Module: PlanMyStuff

Defined in:
lib/plan_my_stuff.rb,
lib/plan_my_stuff/issue.rb,
lib/plan_my_stuff/label.rb,
lib/plan_my_stuff/client.rb,
lib/plan_my_stuff/engine.rb,
lib/plan_my_stuff/errors.rb,
lib/plan_my_stuff/comment.rb,
lib/plan_my_stuff/project.rb,
lib/plan_my_stuff/version.rb,
lib/plan_my_stuff/markdown.rb,
lib/plan_my_stuff/verifier.rb,
lib/plan_my_stuff/project_item.rb,
lib/plan_my_stuff/test_helpers.rb,
lib/plan_my_stuff/base_metadata.rb,
lib/plan_my_stuff/configuration.rb,
lib/plan_my_stuff/custom_fields.rb,
lib/plan_my_stuff/user_resolver.rb,
lib/plan_my_stuff/issue_metadata.rb,
lib/plan_my_stuff/metadata_parser.rb,
lib/plan_my_stuff/comment_metadata.rb,
lib/plan_my_stuff/application_record.rb,
app/controllers/plan_my_stuff/issues_controller.rb,
app/controllers/plan_my_stuff/labels_controller.rb,
app/controllers/plan_my_stuff/comments_controller.rb,
app/controllers/plan_my_stuff/projects_controller.rb,
lib/generators/plan_my_stuff/views/views_generator.rb,
app/controllers/plan_my_stuff/application_controller.rb,
app/controllers/plan_my_stuff/project_items_controller.rb,
lib/generators/plan_my_stuff/install/install_generator.rb

Defined Under Namespace

Modules: Generators, Markdown, MetadataParser, TestHelpers, UserResolver, VERSION Classes: APIError, ApplicationController, ApplicationRecord, BaseMetadata, Client, Comment, CommentMetadata, CommentsController, Configuration, ConfigurationError, CustomFields, Engine, Error, GraphQLError, Issue, IssueMetadata, IssuesController, Label, LabelsController, Project, ProjectItem, ProjectItemsController, ProjectsController, RateLimitError, StaleObjectError, ValidationError, Verifier

Class Method Summary collapse

Class Method Details

.clientPlanMyStuff::Client

Returns:



39
40
41
# File 'lib/plan_my_stuff.rb', line 39

def client
  @client ||= Client.new
end

.configurationPlanMyStuff::Configuration



29
30
31
# File 'lib/plan_my_stuff.rb', line 29

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ PlanMyStuff::Configuration



34
35
36
# File 'lib/plan_my_stuff.rb', line 34

def configure
  yield(configuration)
end

.exit_test_mode!void

This method returns an undefined value.

Restores original class methods overwritten by test_mode!



275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/plan_my_stuff/test_helpers.rb', line 275

def exit_test_mode!
  return unless @_test_mode

  (@_test_mode_originals || {}).each do |klass, methods|
    methods.each do |name, original|
      klass.define_singleton_method(name, original)
    end
  end

  @_test_mode_originals = nil
  @_test_mode = false
  TestHelpers.recorded_actions = []
end

.reset!void

This method returns an undefined value.

Resets the memoized client and configuration. Useful for testing.



60
61
62
63
64
# File 'lib/plan_my_stuff.rb', line 60

def reset!
  exit_test_mode! if defined?(@_test_mode) && @_test_mode
  @client = nil
  @configuration = nil
end

.test_mode!void

This method returns an undefined value.

Activates test mode: stubs all API-calling class methods on Issue, Comment, and ProjectItem so no real HTTP requests are made. Records all actions for assertion matchers.



259
260
261
262
263
264
265
266
267
268
269
# File 'lib/plan_my_stuff/test_helpers.rb', line 259

def test_mode!
  TestHelpers.recorded_actions = []
  return if @_test_mode

  @_test_mode_originals = {}
  stub_issue_class_methods!
  stub_comment_class_methods!
  stub_project_class_methods!
  stub_project_item_class_methods!
  @_test_mode = true
end

.unprocessable_statusSymbol

Returns the appropriate HTTP 422 status symbol for the current Rails version. Rails 7.1+ deprecated :unprocessable_entity in favor of :unprocessable_content.

Returns:

  • (Symbol)


48
49
50
51
52
53
54
# File 'lib/plan_my_stuff.rb', line 48

def unprocessable_status
  if Gem::Version.new(Rails.version) >= Gem::Version.new('7.1')
    :unprocessable_content
  else
    :unprocessable_entity
  end
end