No release in over 3 years
Low commit activity in last 3 years
REST client for the HelpScout Mailbox API V2
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
>= 12.3.3
~> 3.0
~> 3.8

Runtime

 Project Readme

Helpscout::Mailbox::V2::Client

Build status Gem Version

Super simple REST client for the HelpScout V2 Mailbox API

It uses the following gems to work with HelpScout

Installation

Add this line to your application's Gemfile:

gem 'helpscout-mailbox-v2-client'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install helpscout-mailbox-v2-client

Usage

Helpscout::Mailbox::V2::Client::Http.new

Creates a new Client class and authorises the client with HelpScout

Parameter Type Description
client_id string Required HelpScout API client id
client_secret string Required HelpScout API client secret
base_url string Optional HelpScout API url (defaults to https://api.helpscout.net)
require 'helpscout/mailbox/client'

client = Helpscout::Mailbox::V2::Client::Http.new(client_id: 'some id', client_secret: 'keep it secret')
# => 'BMEv1lmcNgDBpOFNHo8TPlODMrF3BG5T'

Helpscout::Mailbox::V2::Client.generate_path

Generates path and method mappings for the api - see Helpscout::Mailbox::Paths

Parameter Type Description
path symbol Required See mappings
values string Required See mappings
path_map = client.generate_path :v2_conversation, {conversation_id: 1089909636}
# => {:method=>"GET", :path=>"/v2/conversations/1089909636"}

Helpscout::Mailbox::V2::Client.request

Sends a request

Parameter Type Description
method string Required HTTP method
path string Required API path
params hash Optional URL params
path_map = client.generate_path :v2_conversation, {conversation_id: 1089909636}
# => {:method=>"GET", :path=>"/v2/conversations/1089909636"}

response = client.request path_map[:method], path_map[:path], {eat: 'cheese'}
# => <Net::HTTPOK 200  readbody=true>

Helpscout::Mailbox::V2::Client.json_request

Sends a JSON request

Parameter Type Description
method string Required HTTP method
path string Required API path
body hash Required Payload
params hash Optional URL params
path_map = client.generate_path :v2_conversations_tags_update, {conversation_id: 1089909636}
# => {:method=>"PUT", :path=>"/v2/conversations/1089909636/tags"}

response = client.json_request path_map[:method], path_map[:path], { tags: ['clam'] }, {eat: 'cheese'}
# => <Net::HTTPOK 200  readbody=true>

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/helpscout-mailbox-v2-client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Helpscout::Mailbox::V2::Client project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.