Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new functionality to HelpScout::Threads (create, update, get) #13

Merged
merged 7 commits into from
Jul 19, 2019

Conversation

jjustinwhite
Copy link
Contributor

This adds functionality to create and update a thread via the API. It also attempts to provide a "get" functionality, despite the HelpScout 2.0 API not supporting such an endpoint. It also update the README to reflect the API functionality lacking for a true GET and DELETE for Threads.

Copy link
Contributor

@prsimp prsimp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jjustinwhite thanks for the PR! I've left a few small comments but generally speaking this looks great. I'm looking in to fixing our Travis configuration so that PR builds will run correctly.

I think our VCR sanitization is strong enough that you should be able to record cassettes for these if you'd like, but if you'd prefer, I'm happy to record them myself and add them to the PR. Just let me know.

Thanks again for your work here 🤘

lib/help_scout/thread.rb Show resolved Hide resolved
lib/help_scout/thread.rb Show resolved Hide resolved
spec/integration/thread_spec.rb Outdated Show resolved Hide resolved
@prsimp prsimp added the enhancement New feature or request label Jul 9, 2019
@prsimp prsimp added this to the v1.2.0 milestone Jul 9, 2019
@prsimp prsimp requested a review from andremleblanc July 16, 2019 19:29
Copy link
Contributor

@prsimp prsimp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andremleblanc -- I went ahead and implemented my suggested changes. This could probably use another quick set of eyes for final approval.

Thanks again @jjustinwhite for the initial work!

@jjustinwhite
Copy link
Contributor Author

Eek, I missed my notifications on this! Nice work @prsimp :) I'd never used VCR, and I tried figuring out how to record my own, but never figured it out. I'll have to look through what you did and figure out what I was doing wrong. Thanks for finishing that off!

Copy link
Contributor

@andremleblanc andremleblanc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of nitpicks, but overall looks good to me. Will test this a little later tonight.

lib/help_scout/thread.rb Show resolved Hide resolved
@@ -2,6 +2,15 @@

RSpec.describe HelpScout::Thread do
let(:conversation_id) { ENV.fetch('TEST_CONVERSATION_ID') }
let(:thread_id) { ENV.fetch('TEST_THREAD_ID') }

describe '.get' do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like our getable shared example could be expanded to handle multiple args, but since I think this is the first instance of it, I'm cool with saving that for later.

@andremleblanc
Copy link
Contributor

I think it would also be nice to add subclasses to thread (or some other abstraction) to document what valid thread types are.

For instance, to create a chat thread, you'd do something like:

HelpScout::Thread.create(1234, 'chats', { customer: { id: 5678 }, text: "Hey there" })

What do you think about something like:

HelpScout::Chat.create(conversation_id: 1234, customer_id: 5678, text: "Hey there")

That being said, I could see adding this abstraction later and not having to break the interface, so I'm good with this for now.

@prsimp

@andremleblanc
Copy link
Contributor

Tested this locally and works as expected 👍

@jjustinwhite
Copy link
Contributor Author

Thanks for the review @andremleblanc & @prsimp! I agree, subclasses like HelpScout::Chat would look a lot nicer than passing the thread type into HelpScout::Thread. I'd be happy to take a stab at that in another PR too.

@prsimp
Copy link
Contributor

prsimp commented Jul 19, 2019

I think it would also be nice to add subclasses to thread (or some other abstraction) to document what valid thread types are.

Absolutely. I think the same can be said for Thread and Conversation updates. Encapsulating (or at least validating) the somewhat arcane syntax into something like Conversation#update_subject would be really nice.

I'd be happy to take a stab at that in another PR too.

@jjustinwhite thanks! Feel free to take a stab at it if you find some time -- I'll open an Issue for some ongoing discussion about the topic.

@prsimp prsimp merged commit 0a3b933 into taxjar:master Jul 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants