Class: Melaya::BugsAPI

Inherits:
Object
  • Object
show all
Defined in:
lib/melaya/bugs.rb

Overview

Bugs API — submit and track bug reports.

Maps to /api/v1/private/bugs/*.

Examples:

melaya.bugs.create(title: "UI crash", description: "...")
reports = melaya.bugs.list_mine

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ BugsAPI

Returns a new instance of BugsAPI.



12
13
14
# File 'lib/melaya/bugs.rb', line 12

def initialize(http)
  @http = http
end

Instance Method Details

#add_comment(bug_id, comment:) ⇒ Object

POST /api/v1/private/bugs/:bugId/comments Add a comment to a bug report.

Parameters:

  • bug_id (String)
  • comment (String)


45
46
47
# File 'lib/melaya/bugs.rb', line 45

def add_comment(bug_id, comment:)
  @http.post("/api/v1/private/bugs/#{enc(bug_id)}/comments", "comment" => comment)
end

#create(title:, description: nil, **extra) ⇒ Object

POST /api/v1/private/bugs Submit a bug report (user-facing feedback form).

Parameters:

  • title (String)
  • description (String) (defaults to: nil)
  • extra (Hash)

    any additional fields



21
22
23
24
25
26
# File 'lib/melaya/bugs.rb', line 21

def create(title:, description: nil, **extra)
  body = extra.transform_keys(&:to_s)
  body["title"]       = title
  body["description"] = description unless description.nil?
  @http.post("/api/v1/private/bugs", body)
end

#get(bug_id) ⇒ Object

GET /api/v1/private/bugs/:bugId Get a single bug report by ID.

Parameters:

  • bug_id (String)


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

def get(bug_id)
  @http.get("/api/v1/private/bugs/#{enc(bug_id)}")
end

#list_mineObject

GET /api/v1/private/bugs/mine List bug reports submitted by the caller.



30
31
32
# File 'lib/melaya/bugs.rb', line 30

def list_mine
  @http.get("/api/v1/private/bugs/mine")
end

#list_notificationsObject

GET /api/v1/private/bugs/notifications List unread bug-related notifications for the caller.



51
52
53
# File 'lib/melaya/bugs.rb', line 51

def list_notifications
  @http.get("/api/v1/private/bugs/notifications")
end

#mark_notifications_read(body = {}) ⇒ Object

POST /api/v1/private/bugs/notifications/read Mark bug notifications as read.



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

def mark_notifications_read(body = {})
  @http.post("/api/v1/private/bugs/notifications/read", body)
end