Module: Avmtrf1::RestProvider::Instance::Issues

Defined in:
lib/avmtrf1/rest_provider/instance/issues.rb

Instance Method Summary collapse

Instance Method Details

#find_issue(global_issue_id) ⇒ Object


7
8
9
10
# File 'lib/avmtrf1/rest_provider/instance/issues.rb', line 7

def find_issue(global_issue_id)
  parsed = self.class.parse_issue_id(global_issue_id)
  parsed.present? ? issue(parsed.provider_issue_id) : nil
end

#issue(provider_issue_id) ⇒ Object


12
13
14
# File 'lib/avmtrf1/rest_provider/instance/issues.rb', line 12

def issue(provider_issue_id)
  issue_request(provider_issue_id).response.body_data_or_raise
end

#issue_classObject


24
25
26
# File 'lib/avmtrf1/rest_provider/instance/issues.rb', line 24

def issue_class
  "#{self.class.name.deconstantize}::Entities::Issue".constantize
end

#issue_request(provider_issue_id) ⇒ Avmtrf1::RestProvider::Request


17
18
19
20
21
22
# File 'lib/avmtrf1/rest_provider/instance/issues.rb', line 17

def issue_request(provider_issue_id)
  request_json(issue_get_url_suffix(provider_issue_id)) do |data|
    data = issue_class.parse_data(data) if issue_class.respond_to?(:parse_data)
    data.present? ? issue_class.new(self, data) : nil
  end
end