Sha256: 864cc7ef115392e44bcfc6ef3a5e766da0be2c2e018d48281b52a8ceb8c8b0a7

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

class YouTrack::Client::CreateIssue < YouTrack::Client::Request
  def real(params)
    service.request(
      :path   => "/issue",
      :method => :put,
      :params => params,
      :parser => YouTrack::Parser::IssueParser,
    )
  end

  def mock(_params)
    params = Cistern::Hash.stringify_keys(_params)

    issue = Cistern::Hash.slice(params, "project", "description", "summary")

    project = issue["projectShortName"] = issue.delete("project")

    identity = service.data[:issues].size + 1


    issue.merge!(
      "id"               => "#{project}-#{identity}",
      "tag"              => "",
      "numberInProject"  => identity,
      "created"          => Time.now.to_i * 1000,
      "updated"          => Time.now.to_i * 1000,
      "updaterName"      => service.username,
      "updaterFullName"  => service.username.capitalize,
      "reporterName"     => service.username,
      "reporterFullName" => service.username.capitalize,
      "commentsCount"    => "0",
      "votes"            => "0",
      "custom_fields"    => [], # @fixme need these
      "attachments"      => [],
    )

    service.response(
      :body   => issue,
      :status => 201,
    )
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
you_track-0.1.0 lib/you_track/client/create_issue.rb