help_scout 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/help_scout.gemspec +5 -5
- data/lib/help_scout/version.rb +1 -1
- data/lib/help_scout.rb +16 -3
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f27ff741d4ccc82fb4287002adc48c4d403edcf
|
4
|
+
data.tar.gz: 7558de8f0a788e6f7250bf9a91cb510ad4511632
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0df4d12cd56011d90eab0123473a63b77bdee5dbd9283ca921da1f4b233477191115f747cd69a9359969e65e4b4fbd05b2a5496faf0684a21b8b5933a24db3a4
|
7
|
+
data.tar.gz: 2113ec54b0811a46f4d9ad255a21de79126d55d1e4ef357e97c3a11859b247537da66d9440e865ce78830443d1141ac6e871464c603c4de752f4c72655f47925
|
data/help_scout.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Dennis Paagman", "Miriam Tocino", "Mark Mulder"]
|
10
10
|
spec.email = ["dennispaagman@gmail.com", "miriam.tocino@gmail.com", "markmulder@gmail.com"]
|
11
11
|
|
12
|
-
spec.summary = "HelpScout is
|
12
|
+
spec.summary = "HelpScout is an API client for Help Scout"
|
13
13
|
spec.homepage = "https://github.com/Springest/help_scout"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -18,11 +18,11 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_runtime_dependency "httparty", "~> 0.
|
21
|
+
spec.add_runtime_dependency "httparty", "~> 0.14"
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.12"
|
24
|
-
spec.add_development_dependency "rake", "~> 10.
|
25
|
-
spec.add_development_dependency "rspec", "~> 3.
|
26
|
-
spec.add_development_dependency "webmock", "~> 2.
|
24
|
+
spec.add_development_dependency "rake", "~> 10.5"
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.5"
|
26
|
+
spec.add_development_dependency "webmock", "~> 2.1"
|
27
27
|
spec.add_development_dependency "byebug"
|
28
28
|
end
|
data/lib/help_scout/version.rb
CHANGED
data/lib/help_scout.rb
CHANGED
@@ -2,6 +2,12 @@ require "help_scout/version"
|
|
2
2
|
require "httparty"
|
3
3
|
|
4
4
|
class HelpScout
|
5
|
+
class ValidationError < StandardError; end
|
6
|
+
class NotImplementedError < StandardError; end
|
7
|
+
|
8
|
+
HTTP_CREATED = 201
|
9
|
+
HTTP_BAD_REQUEST = 400
|
10
|
+
|
5
11
|
attr_accessor :last_response
|
6
12
|
|
7
13
|
def initialize(api_key)
|
@@ -18,9 +24,16 @@ class HelpScout
|
|
18
24
|
def create_conversation(data)
|
19
25
|
post("conversations", { body: data })
|
20
26
|
|
21
|
-
|
22
|
-
|
23
|
-
|
27
|
+
if last_response.code == HTTP_CREATED
|
28
|
+
# Extract ID of created conversation from the Location header
|
29
|
+
conversation_uri = last_response.headers["location"]
|
30
|
+
return conversation_uri.match(/(\d+)\.json$/)[1]
|
31
|
+
elsif last_response.code == HTTP_BAD_REQUEST
|
32
|
+
# Validation failed so return the errors
|
33
|
+
raise ValidationError, last_response.parsed_response["message"]
|
34
|
+
else
|
35
|
+
raise NotImplementedError, "Help Scout returned something that is not implemented by the help_scout gem yet. Sorry."
|
36
|
+
end
|
24
37
|
end
|
25
38
|
|
26
39
|
# Public: Get conversation
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: help_scout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dennis Paagman
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '0.
|
21
|
+
version: '0.14'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: '0.
|
28
|
+
version: '0.14'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: bundler
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -46,42 +46,42 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '10.
|
49
|
+
version: '10.5'
|
50
50
|
type: :development
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: '10.
|
56
|
+
version: '10.5'
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: rspec
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: '3.
|
63
|
+
version: '3.5'
|
64
64
|
type: :development
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - "~>"
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: '3.
|
70
|
+
version: '3.5'
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: webmock
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
75
|
- - "~>"
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: '2.
|
77
|
+
version: '2.1'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
82
|
- - "~>"
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: '2.
|
84
|
+
version: '2.1'
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
86
|
name: byebug
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,5 +140,5 @@ rubyforge_project:
|
|
140
140
|
rubygems_version: 2.5.1
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
|
-
summary: HelpScout is
|
143
|
+
summary: HelpScout is an API client for Help Scout
|
144
144
|
test_files: []
|