项目作者: jayco

项目描述 :
HelpScout mailbox api path generator
高级语言: Ruby
项目地址: git://github.com/jayco/helpscout-mailbox-paths.git
创建时间: 2020-03-12T08:30:54Z
项目社区:https://github.com/jayco/helpscout-mailbox-paths

开源协议:MIT License

下载


Helpscout::Mailbox::Paths

Build statusGem Version

Simple gem mixin for generating helpscout paths with params

Installation

Add this line to your application’s Gemfile:

  1. gem 'helpscout-mailbox-paths'

And then execute:

  1. $ bundle

Or install it yourself as:

  1. $ gem install helpscout-mailbox-paths

Usage

Helpscout::Mailbox::Paths.generate_path()

  1. require 'helpscout/mailbox/paths'
  2. class SomeClient
  3. include Helpscout::Mailbox::Paths
  4. def send(method, path)
  5. # do some request stuffs...
  6. end
  7. end
  8. client = SomeClient.new
  9. api = client.generate_path(:v2_conversation, {conversation_id: 1089909636})
  10. # => {:method=>"GET", :path=>"/v2/conversations/1089909636"}
  11. client.send(api[:method], api[:path])

API Mapping

  1. PATH_MAP = {
  2. v2_conversations_create: ['POST', '/v2/conversations'],
  3. v2_conversations: ['GET', '/v2/conversations'],
  4. v2_conversations_delete: ['DELETE', '/v2/conversations/%{conversation_id}'],
  5. v2_conversation: ['GET', '/v2/conversations/%{conversation_id}'],
  6. v2_conversations_update: ['PATCH', '/v2/conversations/%{conversation_id}'],
  7. v2_conversations_attachment_delete: ['DELETE', '/v2/conversations/%{conversation_id}/attachments/%{attachment_id}'],
  8. v2_conversations_attachment: ['GET', '/v2/conversations/%{conversation_id}/attachments/%{attachment_id}/data'],
  9. v2_conversations_attachment_create: ['POST', '/v2/conversations/%{conversation_id}/threads/%{thread_id}/attachments'],
  10. v2_conversations_fields_update: ['PUT', '/v2/conversations/%{conversation_id}/fields'],
  11. v2_conversations_tags_update: ['PUT', '/v2/conversations/%{conversation_id}/tags'],
  12. v2_conversations_chat_create: ['POST', '/v2/conversations/%{conversation_id}/chats'],
  13. v2_conversations_note_create: ['POST', '/v2/conversations/%{conversation_id}/notes'],
  14. v2_conversations_phone_create: ['POST', '/v2/conversations/%{conversation_id}/phones'],
  15. v2_conversations_reply_create: ['POST', '/v2/conversations/%{conversation_id}/reply'],
  16. v2_conversations_original_source: ['GET', '/v2/conversations/%{conversation_id}/threads/%{thread_id}/original-source'],
  17. v2_conversations_thread_create: ['POST', '/v2/conversations/%{conversation_id}/customer'],
  18. v2_conversations_thread_list: ['GET', '/v2/conversations/%{conversation_id}/threads'],
  19. v2_conversations_thread_update: ['PATCH', '/v2/conversations/%{conversation_id}/threads/%{thread_id}'],
  20. v2_conversations_customer_properties: ['GET', '/v2/customer-properties'],
  21. v2_customers: ['GET', '/v2/customers'],
  22. v2_customers_create: ['POST', '/v2/customers'],
  23. v2_customer: ['GET', '/v2/customers/%{customer_id}'],
  24. v2_customers_overwrite: ['PUT', '/v2/customers/%{customer_id}'],
  25. v2_customers_update: ['PATCH', '/v2/customers/%{customer_id}'],
  26. v2_customers_address_create: ['POST', '/v2/customers/%{customer_id}/address'],
  27. v2_customers_address_delete: ['DELETE', '/v2/customers/%{customer_id}/address'],
  28. v2_customers_address: ['GET', '/v2/customers/%{customer_id}/address'],
  29. v2_customers_address_update: ['PATCH', '/v2/customers/%{customer_id}/address'],
  30. v2_customers_chats: ['GET', '/v2/customers/%{customer_id}/chats'],
  31. v2_customers_chats_create: ['POST', '/v2/customers/%{customer_id}/chats/%{chat_id}'],
  32. v2_customers_chats_update: ['PUT', '/v2/customers/%{customer_id}/chats/%{chat_id}'],
  33. v2_customers_emails_create: ['POST', '/v2/customers/%{customer_id}/emails'],
  34. v2_customers_emails: ['GET', '/v2/customers/%{customer_id}/emails'],
  35. v2_customers_emails_update: ['PUT', '/v2/customers/%{customer_id}/emails/%{email_id}'],
  36. v2_customers_emails_delete: ['DELETE', '/v2/customers/%{customer_id}/emails/%{email_id}'],
  37. v2_customers_phones_create: ['POST', '/v2/customers/%{customer_id}/phones'],
  38. v2_customers_phones: ['GET', '/v2/customers/%{customer_id}/phones'],
  39. v2_customers_phones_update: ['PUT', '/v2/customers/%{customer_id}/phones/%{phone_id}'],
  40. v2_customers_phones_delete: ['DELETE', '/v2/customers/%{customer_id}/phones/%{phone_id}'],
  41. v2_customers_social_create: ['POST', '/v2/customers/%{customer_id}/social-profiles'],
  42. v2_customers_social: ['GET', '/v2/customers/%{customer_id}/social-profiles'],
  43. v2_customers_social_update: ['PUT', '/v2/customers/%{customer_id}/social-profiles/%{profile_id}'],
  44. v2_customers_social_delete: ['DELETE', '/v2/customers/%{customer_id}/social-profiles/%{profile_id}'],
  45. v2_customers_website_create: ['POST', '/v2/customers/%{customer_id}/websites'],
  46. v2_customers_website: ['GET', '/v2/customers/%{customer_id}/websites'],
  47. v2_customers_website_update: ['PUT', '/v2/customers/%{customer_id}/websites/%{website_id}'],
  48. v2_customers_website_delete: ['DELETE', '/v2/customers/%{customer_id}/websites/%{website_id}'],
  49. v2_customers_properties_update: ['PATCH', '/v2/customers/%{customer_id}/properties'],
  50. v2_mailboxes: ['GET', '/v2/mailboxes'],
  51. v2_mailbox: ['GET', '/v2/mailboxes/%{mailbox_id}'],
  52. v2_mailbox_fields: ['GET', '/v2/mailboxes/%{mailbox_id}/fields'],
  53. v2_mailbox_folders: ['GET', '/v2/mailboxes/%{mailbox_id}/folders'],
  54. v2_ratings: ['GET', '/v2/ratings/%{rating_id}'],
  55. v2_reports_company: ['GET', '/v2/reports/company'],
  56. v2_reports_company_customers_helped: ['GET', '/v2/reports/company/customers-helped'],
  57. v2_reports_company_drilldown: ['GET', '/v2/reports/company/drilldown'],
  58. v2_reports_conversations: ['GET', '/v2/reports/conversations'],
  59. v2_reports_conversations_new: ['GET', '/v2/reports/conversations/new'],
  60. v2_reports_conversations_channel_volume: ['GET', '/v2/reports/conversations/volume-by-channel'],
  61. v2_reports_conversations_busy_times: ['GET', '/v2/reports/conversations/busy-times'],
  62. v2_reports_conversations_drilldown: ['GET', '/v2/reports/conversations/drilldown'],
  63. v2_reports_conversations_new_drilldown: ['GET', '/v2/reports/conversations/new-drilldown'],
  64. v2_reports_conversations_fields_drilldown: ['GET', '/v2/reports/conversations/fields-drilldown'],
  65. v2_reports_conversations_messages_received: ['GET', '/v2/reports/conversations/received-messages'],
  66. v2_reports_docs: ['GET', '/v2/reports/docs'],
  67. v2_reports_happiness: ['GET', '/v2/reports/happiness'],
  68. v2_reports_happiness_ratings: ['GET', '/v2/reports/happiness/ratings'],
  69. v2_reports_productivity: ['GET', '/v2/reports/productivity'],
  70. v2_reports_productivity_first_response_times: ['GET', '/v2/reports/productivity/first-response-time'],
  71. v2_reports_productivity_replies: ['GET', '/v2/reports/productivity/replies-sent'],
  72. v2_reports_productivity_resolutions_times: ['GET', '/v2/reports/productivity/resolution-time'],
  73. v2_reports_productivity_resolved: ['GET', '/v2/reports/productivity/resolved'],
  74. v2_reports_productivity_response_times: ['GET', '/v2/reports/productivity/response-time'],
  75. v2_reports_user: ['GET', '/v2/reports/user'],
  76. v2_reports_user_conversation_history: ['GET', '/v2/reports/user/conversation-history'],
  77. v2_reports_user_customers_helped: ['GET', '/v2/reports/user/customers-helped'],
  78. v2_reports_user_happiness: ['GET', '/v2/reports/user/happiness'],
  79. v2_reports_user_ratings: ['GET', '/v2/reports/user/ratings'],
  80. v2_reports_user_replies: ['GET', '/v2/reports/user/replies'],
  81. v2_reports_user_resolutions: ['GET', '/v2/reports/user/resolutions'],
  82. v2_reports_user_drilldown: ['GET', '/v2/reports/user/drilldown'],
  83. v2_reports_chat: ['GET', '/v2/reports/chat'],
  84. v2_reports_email: ['GET', '/v2/reports/email'],
  85. v2_reports_phone: ['GET', '/v2/reports/phone'],
  86. v2_tags: ['GET', '/v2/tags'],
  87. v2_teams: ['GET', '/v2/teams'],
  88. v2_teams_members: ['GET', '/v2/teams/%{team_id}/members'],
  89. v2_users: ['GET', '/v2/users'],
  90. v2_me: ['GET', '/v2/users/me'],
  91. v2_user: ['GET', '/v2/users/%{user_id}'],
  92. v2_webhooks_create: ['POST', '/v2/webhooks'],
  93. v2_webhooks: ['GET', '/v2/webhooks'],
  94. v2_webhook: ['GET', '/v2/webhooks/%{webhook_id}'],
  95. v2_webhooks_update: ['PUT', '/v2/webhooks/%{webhook_id}'],
  96. v2_webhooks_delete: ['DELETE', '/v2/webhooks/%{webhook_id}'],
  97. v2_workflows: ['GET', '/v2/workflows'],
  98. v2_workflows_run: ['POST', '/v2/workflows/%{workflow_id}/run'],
  99. v2_workflows_update: ['PATCH', '/v2/workflows/%{workflow_id}']
  100. }

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/jayco/helpscout-mailbox-paths. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant 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::Paths project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.