Class: Avmtrf1::Redmine::Instance

Inherits:
Avmtrf1::RestProvider::Instance show all
Defined in:
lib/avmtrf1/redmine/instance.rb

Constant Summary collapse

ISSUE_ID_PATTERN =
/\Aredmine_(\d+)\z/i.freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Avmtrf1::RestProvider::Instance

#request, #request_json

Class Method Details

.parse_issue_id(issue_id) ⇒ Object


13
14
15
16
# File 'lib/avmtrf1/redmine/instance.rb', line 13

def parse_issue_id(issue_id)
  m = ISSUE_ID_PATTERN.match(issue_id)
  m ? ::OpenStruct.new(provider_issue_id: m[1]) : nil
end

Instance Method Details

#build_service_url(service_url_suffix) ⇒ Object


19
20
21
# File 'lib/avmtrf1/redmine/instance.rb', line 19

def build_service_url(service_url_suffix)
  "#{root_url}#{service_url_suffix}.json"
end

#issue_get_url_suffix(provider_issue_id) ⇒ Object


23
24
25
# File 'lib/avmtrf1/redmine/instance.rb', line 23

def issue_get_url_suffix(provider_issue_id)
  "/issues/#{provider_issue_id}"
end

#issue_status(issue_status_id) ⇒ Object


27
28
29
# File 'lib/avmtrf1/redmine/instance.rb', line 27

def issue_status(issue_status_id)
  issue_statuses.find { |issue_status| issue_status.id == issue_status_id }
end