Module: PlanMyStuff

Defined in:
lib/plan_my_stuff.rb,
lib/plan_my_stuff/link.rb,
lib/plan_my_stuff/repo.rb,
lib/plan_my_stuff/cache.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/archive.rb,
lib/plan_my_stuff/comment.rb,
lib/plan_my_stuff/project.rb,
lib/plan_my_stuff/version.rb,
lib/plan_my_stuff/approval.rb,
lib/plan_my_stuff/markdown.rb,
lib/plan_my_stuff/pipeline.rb,
lib/plan_my_stuff/verifier.rb,
lib/plan_my_stuff/reminders.rb,
lib/plan_my_stuff/attachment.rb,
lib/plan_my_stuff/issue_field.rb,
lib/plan_my_stuff/base_project.rb,
lib/plan_my_stuff/project_item.rb,
lib/plan_my_stuff/test_helpers.rb,
lib/plan_my_stuff/archive/sweep.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/notifications.rb,
lib/plan_my_stuff/user_resolver.rb,
lib/plan_my_stuff/issue_metadata.rb,
lib/plan_my_stuff/reminders/fire.rb,
lib/plan_my_stuff/graphql/queries.rb,
lib/plan_my_stuff/metadata_parser.rb,
lib/plan_my_stuff/pipeline/status.rb,
lib/plan_my_stuff/reminders/sweep.rb,
lib/plan_my_stuff/testing_project.rb,
lib/plan_my_stuff/comment_metadata.rb,
lib/plan_my_stuff/pipeline/testing.rb,
lib/plan_my_stuff/project_metadata.rb,
lib/plan_my_stuff/reminders/closer.rb,
lib/plan_my_stuff/webhook_replayer.rb,
lib/plan_my_stuff/aws_sns_simulator.rb,
lib/plan_my_stuff/base_project_item.rb,
lib/plan_my_stuff/application_record.rb,
lib/plan_my_stuff/attachment_uploader.rb,
app/jobs/plan_my_stuff/application_job.rb,
lib/plan_my_stuff/testing_project_item.rb,
lib/plan_my_stuff/base_project_metadata.rb,
lib/plan_my_stuff/issue_field_value_set.rb,
lib/plan_my_stuff/pipeline/issue_linker.rb,
lib/plan_my_stuff/project_item_metadata.rb,
lib/plan_my_stuff/issue_extractions/links.rb,
app/jobs/plan_my_stuff/reminders_sweep_job.rb,
lib/plan_my_stuff/pipeline/completed_sweep.rb,
lib/plan_my_stuff/testing_project_metadata.rb,
lib/plan_my_stuff/issue_extractions/viewers.rb,
lib/plan_my_stuff/issue_extractions/waiting.rb,
lib/plan_my_stuff/issue_extractions/approvals.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/issues/links_controller.rb,
app/controllers/plan_my_stuff/issues/takes_controller.rb,
app/controllers/plan_my_stuff/webhooks/aws_controller.rb,
app/controllers/plan_my_stuff/project_items_controller.rb,
lib/generators/plan_my_stuff/install/install_generator.rb,
app/controllers/plan_my_stuff/issues/viewers_controller.rb,
app/controllers/plan_my_stuff/issues/closures_controller.rb,
app/controllers/plan_my_stuff/issues/waitings_controller.rb,
app/controllers/plan_my_stuff/webhooks/github_controller.rb,
app/controllers/plan_my_stuff/issues/approvals_controller.rb,
app/controllers/plan_my_stuff/testing_projects_controller.rb,
lib/plan_my_stuff/base_project_extractions/graphql_hydration.rb,
app/controllers/plan_my_stuff/testing_project_items_controller.rb,
app/controllers/plan_my_stuff/project_items/statuses_controller.rb,
app/controllers/plan_my_stuff/project_items/assignments_controller.rb,
app/controllers/plan_my_stuff/testing_project_items/results_controller.rb

Defined Under Namespace

Modules: Archive, AwsSnsSimulator, BaseProjectExtractions, Cache, Generators, GraphQL, IssueExtractions, Issues, Markdown, MetadataParser, Notifications, Pipeline, ProjectItems, Reminders, TestHelpers, TestingProjectItems, UserResolver, VERSION, WebhookReplayer, Webhooks Classes: APIError, ApplicationController, ApplicationJob, ApplicationRecord, Approval, Attachment, AttachmentUploader, AuthorizationError, BaseMetadata, BaseProject, BaseProjectItem, BaseProjectMetadata, Client, Comment, CommentMetadata, CommentsController, Configuration, ConfigurationError, CustomFields, Engine, Error, GraphQLError, Issue, IssueField, IssueFieldValueSet, IssueFieldsNotEnabledError, IssueMetadata, IssuesController, Label, LabelsController, Link, LockedIssueError, PendingApprovalsError, PipelineError, Project, ProjectItem, ProjectItemMetadata, ProjectItemsController, ProjectMetadata, ProjectsController, RateLimitError, RemindersSweepJob, Repo, StaleObjectError, TestingProject, TestingProjectItem, TestingProjectItemsController, TestingProjectMetadata, TestingProjectsController, ValidationError, Verifier, WebhookSignatureError

Class Method Summary collapse

Class Method Details

.clientPlanMyStuff::Client

Returns:



52
53
54
# File 'lib/plan_my_stuff.rb', line 52

def client
  @client ||= PlanMyStuff::Client.new
end

.configurationPlanMyStuff::Configuration



37
38
39
# File 'lib/plan_my_stuff.rb', line 37

def configuration
  @configuration ||= PlanMyStuff::Configuration.new
end

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



47
48
49
# File 'lib/plan_my_stuff.rb', line 47

def configure
  yield(configuration)
end

.deprecatorActiveSupport::Deprecation

Returns:

  • (ActiveSupport::Deprecation)


42
43
44
# File 'lib/plan_my_stuff.rb', line 42

def deprecator
  @deprecator ||= ActiveSupport::Deprecation.new('1.0', 'PlanMyStuff')
end

.exit_test_mode!void

This method returns an undefined value.

Restores original class / instance methods overwritten by test_mode!



362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# File 'lib/plan_my_stuff/test_helpers.rb', line 362

def exit_test_mode!
  return unless @_test_mode

  (@_test_mode_originals || {}).each do |klass, methods|
    methods.each do |key, original|
      kind, name = key
      if kind == :instance
        klass.define_method(name, original)
      else
        klass.define_singleton_method(name, original)
      end
    end
  end

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

.format_time(value) ⇒ String?

Formats a time-ish value as an ISO 8601 string. Time and DateTime are normalized to UTC; Date is serialized as-is.

Parameters:

  • value (Time, DateTime, Date, String, nil)

Returns:

  • (String, nil)


81
82
83
84
85
86
87
# File 'lib/plan_my_stuff.rb', line 81

def format_time(value)
  return if value.nil?
  return value if value.is_a?(String)
  return value.iso8601 if value.is_a?(Date) && !value.is_a?(DateTime)

  value.utc.iso8601
end

.import_clientPlanMyStuff::Client

Returns:



57
58
59
# File 'lib/plan_my_stuff.rb', line 57

def import_client
  @import_client ||= PlanMyStuff::Client.new(importing: true)
end

.reset!void

This method returns an undefined value.

Resets the memoized client and configuration. Useful for testing.



93
94
95
96
97
98
99
# File 'lib/plan_my_stuff.rb', line 93

def reset!
  exit_test_mode! if defined?(@_test_mode) && @_test_mode
  PlanMyStuff::Client.exit_trace_mode!
  @client = nil
  @import_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.



345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/plan_my_stuff/test_helpers.rb', line 345

def test_mode!
  PlanMyStuff::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!
  stub_pipeline_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)


66
67
68
69
70
71
72
# File 'lib/plan_my_stuff.rb', line 66

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