NCEAS / awards-bot

Award management bot for Arctic Data Center management
6 stars 8 forks source link

Check RT for new correspondences #45

Closed laijasmine closed 3 years ago

laijasmine commented 3 years ago
laijasmine commented 3 years ago

this uses a couple of internal rt functions that I adjusted from rt_ticket_history() to look for specific correspondence which is not a best practice. any thoughts on the best way to go about this would be appreciated

url <- rt:::rt_url("ticket", ticket_id, "history/id", id)
response <- rt:::rt_GET(url)
rt:::stopforstatus(response)
amoeba commented 3 years ago

Heya @laijasmine, looks like I goofed and missed adding a function to rt to pull down a ticket history item. I took the time this evening to add that and it's available at https://github.com/NCEAS/rt: rt_ticket_history_entry(ticket_id, history_id). Would you give that a whirl?

I also saw you wrote some helper functions, parse_rt_transaction, and format_history_entry. I hope the first one isn't needed because rt comes with its own version of that function. The second one may or may not be needed though I'm not sure.

If you think the new rt_ticket_history_entry works well as-is, I'll send it off to CRAN ASAP.

laijasmine commented 3 years ago

Hi @amoeba thanks for the speedy work on the RT package! Should have asked about that earlier... and maybe put in a PR.

I testedrt_ticket_history_entry and works great for my use cases. I think it is ready to send it off to CRAN.

I kept format_history_entry as it formats the entry for the slack bot output but grateful that I won't be needing the parse_rt_transaction anymore!

amoeba commented 3 years ago

Sounds great, thanks for testing it out!

laijasmine commented 3 years ago

note to self: (1) make sure to update the DESCRIPTION file for rt to require the version with rt_ticket_history_entry (2) when installing this version of awards bot make sure to update the rt package first

amoeba commented 3 years ago

Heya @laijasmine, the new version or rt (1.1.0) which has the rt_ticket_history_entry is now on CRAN: https://cran.r-project.org/web/packages/rt/index.html.