groovehq 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/lib/groovehq/client/connection.rb +1 -1
- data/lib/groovehq/resource_collection.rb +5 -1
- data/lib/groovehq/version.rb +1 -1
- data/spec/groovehq/integration/customers_spec.rb +3 -3
- data/spec/groovehq/integration/messages_spec.rb +1 -1
- data/spec/groovehq/integration/tickets_spec.rb +19 -0
- data/spec/groovehq/resource_collection_spec.rb +17 -3
- data/spec/spec_helper.rb +3 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ed1b72ce7748263d1816950b4e54798a8a36ea6
|
4
|
+
data.tar.gz: 311110ca7f2c92ec912451f17854f93eecc7a80d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc8bdd133b714ef069f3157adc02ef99b25d67f554d8171246aced2c7f5f84be5970f20fac25f133783e85b4d1b0610953ef6563cdbec5ed7932fef3774654e8
|
7
|
+
data.tar.gz: 4105163e0dbbacbc48d45473ff968ffa4b2569605f250fe429df824835b4f33f6f5c79e37064822950920286fe1384855b3440307279851e4c22b73f006207c9
|
data/.travis.yml
CHANGED
@@ -2,6 +2,7 @@ language: ruby
|
|
2
2
|
cache: bundler
|
3
3
|
script: bundle exec rake spec
|
4
4
|
rvm:
|
5
|
-
- 2.1
|
5
|
+
- 2.3.1
|
6
|
+
- 2.4.1
|
6
7
|
env:
|
7
8
|
secure: "NiB0KwycVqFejW4SIK6bOlrFJMK00gUbPIQMWM59pmmM8NXjLrPsc11JGmFQ14/+GDpX2UXR22ssPM9zWaK+Il6PLhT54GlO5TUOMM+awfWHYgBJ+j/cgwOK485pTVoTM9uzpWl4Qk8W7S1Hv81sqBW1qAXIm+Ttn5ak4c5dNPov1ClP9PqRPO+RVu6bWski2pumAD0PDD4E0MfY53Vq+0DJXKeWYKblDLrEYK7Y4QVTWuL0aV+MaNivFkfTDxaon/23/pRsP1oiOJ5ArJBiVwMSeDJBUkYtZjyOgVLoFKBaS5/SuZQMLrWEvOifuW2QTEMpIlTMHQotFRJRdnGH6wPRYemCl14LR5I/t7zERPKMR6aYC1AbFFjh2hTPTbdKioHul0+iMoYetEE9p5WT+weBMtxyYZtIXrnSpwF0DJ0OzEfGpB1iOckX+rkmVMU+PpZqFsb9ONqxe25sKWHCx7ViYapdqD8twXOAOmNBWojBdKqOkRQ31G/SqGkXUmfwCw1VkKvn9j2Xy6M6a3LwILV9NFzUzb4+z9xZOzuVzGBtxw8P83M2hM4SvAlCELfnsoLMJDAQxdFOHonTU4qHOXiOQxrFl9L7eqPEx3ykvcziRgemghUYvXIT1mGWwSryA1hz+46wrcGJwZv1wJFeb1PlyotIl4bhxEBr1XmErNI="
|
@@ -23,7 +23,7 @@ module GrooveHQ
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def request(http_method, path, options)
|
26
|
-
response = self.class.send(http_method, path, {
|
26
|
+
response = self.class.send(http_method, path, { body: options })
|
27
27
|
data = response.parsed_response
|
28
28
|
parse_data(data)
|
29
29
|
end
|
@@ -20,13 +20,15 @@ module GrooveHQ
|
|
20
20
|
links = {}
|
21
21
|
|
22
22
|
if meta_data.has_key?("pagination")
|
23
|
+
@total_pages = meta_data["pagination"]["total_pages"]
|
24
|
+
@current_page = meta_data["pagination"]["current_page"]
|
23
25
|
links = {
|
24
26
|
next: {
|
25
27
|
href: meta_data["pagination"]["next_page"]
|
26
28
|
},
|
27
29
|
prev: {
|
28
30
|
href: meta_data["pagination"]["prev_page"]
|
29
|
-
}
|
31
|
+
},
|
30
32
|
}
|
31
33
|
end
|
32
34
|
|
@@ -40,6 +42,8 @@ module GrooveHQ
|
|
40
42
|
|
41
43
|
collection.each { |item| yield item }
|
42
44
|
|
45
|
+
return self if @current_page == @total_pages
|
46
|
+
|
43
47
|
rel = @rels[:next] or return self
|
44
48
|
resource_collection = rel.get(@options.except(:page))
|
45
49
|
resource_collection.each(&Proc.new)
|
data/lib/groovehq/version.rb
CHANGED
@@ -8,11 +8,11 @@ describe GrooveHQ::Client::Customers, integration: true do
|
|
8
8
|
describe "#update_customer" do
|
9
9
|
|
10
10
|
it "updates customer info" do
|
11
|
-
|
12
|
-
new_about_text = "Some new about text"
|
11
|
+
new_about_text = "Some new about text " + SecureRandom.uuid
|
13
12
|
response = client.update_customer(customer_email, about: new_about_text)
|
13
|
+
customer = client.customer(customer_email)
|
14
14
|
expect(customer.about).to eq new_about_text
|
15
|
-
expect(response.rels[:tickets]
|
15
|
+
expect(response.rels[:tickets]).not_to be_nil
|
16
16
|
end
|
17
17
|
|
18
18
|
end
|
@@ -16,7 +16,7 @@ describe GrooveHQ::Client::Messages, integration: true do
|
|
16
16
|
|
17
17
|
describe "#message" do
|
18
18
|
|
19
|
-
let(:response) { client.message('
|
19
|
+
let(:response) { client.message('5850909715') }
|
20
20
|
|
21
21
|
it "successfully gets message" do
|
22
22
|
expect(response.data).to have_attributes(created_at: String)
|
@@ -25,6 +25,25 @@ describe GrooveHQ::Client::Tickets, integration: true do
|
|
25
25
|
expect(response.summary).to eq options[:body]
|
26
26
|
end
|
27
27
|
|
28
|
+
it "successfully can include customer details in ticket" do
|
29
|
+
customer_hash = {
|
30
|
+
email: "customer@example.com",
|
31
|
+
about: "Your internal reference",
|
32
|
+
company_name: "SomeCompany Pty Ltd"
|
33
|
+
}
|
34
|
+
|
35
|
+
options = {
|
36
|
+
body: "Some body text",
|
37
|
+
from: "fodojyko@gmail.com",
|
38
|
+
to: customer_hash
|
39
|
+
}
|
40
|
+
response = client.create_ticket(options)
|
41
|
+
customer = response.rels['customer'].get
|
42
|
+
expect(customer.company_name).to eq customer_hash[:company_name]
|
43
|
+
expect(customer.email).to eq customer_hash[:email]
|
44
|
+
expect(customer.about).to eq customer_hash[:about]
|
45
|
+
end
|
46
|
+
|
28
47
|
end
|
29
48
|
|
30
49
|
describe "#ticket" do
|
@@ -63,7 +63,10 @@ describe GrooveHQ::Resource do
|
|
63
63
|
tickets: [{ title: "Ticket 1" }],
|
64
64
|
meta: {
|
65
65
|
pagination: {
|
66
|
-
next_page: "http://api.groovehq.dev/v1/tickets?page=2"
|
66
|
+
next_page: "http://api.groovehq.dev/v1/tickets?page=2",
|
67
|
+
current_page: 1,
|
68
|
+
total_pages: 3,
|
69
|
+
total_count: 3
|
67
70
|
}
|
68
71
|
}
|
69
72
|
}.stringify_keys
|
@@ -73,7 +76,10 @@ describe GrooveHQ::Resource do
|
|
73
76
|
meta: {
|
74
77
|
pagination: {
|
75
78
|
prev_page: "http://api.groovehq.dev/v1/tickets?page=1",
|
76
|
-
next_page: "http://api.groovehq.dev/v1/tickets?page=3"
|
79
|
+
next_page: "http://api.groovehq.dev/v1/tickets?page=3",
|
80
|
+
current_page: 2,
|
81
|
+
total_pages: 3,
|
82
|
+
total_count: 3
|
77
83
|
}
|
78
84
|
}
|
79
85
|
}.stringify_keys
|
@@ -82,11 +88,19 @@ describe GrooveHQ::Resource do
|
|
82
88
|
tickets: [{ title: "Ticket 3"}],
|
83
89
|
meta: {
|
84
90
|
pagination: {
|
91
|
+
next_page: "http://api.groovehq.dev/v1/tickets",
|
85
92
|
prev_page: "http://api.groovehq.dev/v1/tickets?page=2",
|
93
|
+
current_page: 3,
|
94
|
+
total_pages: 3,
|
95
|
+
total_count: 3
|
86
96
|
}
|
87
97
|
}
|
88
98
|
}.stringify_keys
|
89
99
|
|
100
|
+
stub_request(:get, "http://api.groovehq.dev/v1/tickets").
|
101
|
+
with(headers: {'Authorization' => 'Bearer phantogram'}).
|
102
|
+
to_return(body: page_1.to_json, status: 200)
|
103
|
+
|
90
104
|
stub_request(:get, "http://api.groovehq.dev/v1/tickets?page=2").
|
91
105
|
with(headers: {'Authorization' => 'Bearer phantogram'}).
|
92
106
|
to_return(body: page_2.to_json, status: 200)
|
@@ -115,7 +129,7 @@ describe GrooveHQ::Resource do
|
|
115
129
|
|
116
130
|
it "respects :per_page and other parameters except :page" do
|
117
131
|
resource = GrooveHQ::ResourceCollection.new(client, @page_1, page: 1, per_page: 20, foo: "bar")
|
118
|
-
stub_request(:get,
|
132
|
+
stub_request(:get, /http:\/\/api.groovehq.dev\/v1\/tickets\?page=\d+(&per_page=\d+)?(&foo=bar)?/).
|
119
133
|
with(headers: {'Authorization' => 'Bearer phantogram'}).
|
120
134
|
to_return(body: {tickets: []}.to_json, status: 200)
|
121
135
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groovehq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirill Shirinkin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
version: '0'
|
132
132
|
requirements: []
|
133
133
|
rubyforge_project:
|
134
|
-
rubygems_version: 2.
|
134
|
+
rubygems_version: 2.6.8
|
135
135
|
signing_key:
|
136
136
|
specification_version: 4
|
137
137
|
summary: Client library for GrooveHQ API.
|