chatwork 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -1
- data/lib/chatwork/chatwork_error.rb +4 -4
- data/lib/chatwork/client.rb +1 -1
- data/lib/chatwork/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0305dfa12041167303e05f9f0fd9bf05a92bb64f
|
4
|
+
data.tar.gz: b8f95a22e1e7e08c6a17d0b0a125caa8eaccddd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96280714b65def9d004d34f0a857ce7f679f88f379349203566b0f08dd1fd870334ef302c3332bdb07d4b7b6ca1fec80015d7f40ade9a62018474971849d30fe
|
7
|
+
data.tar.gz: f789819c3b1843ebcb5acea28f5ea64ae3201657b1eec5a800da33595ead70bcba6e4978589cb1e3070825359f909f9e2c93d6bdb179fa562f8f23e94bd7319c
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
```
|
21
|
+
``` ruby
|
22
22
|
require "chatwork"
|
23
23
|
|
24
24
|
# Create message
|
@@ -26,6 +26,17 @@ ChatWork.api_key = "XXX"
|
|
26
26
|
ChatWork::Message.create(room_id: 1234, body: "Hello, ChatWork!")
|
27
27
|
```
|
28
28
|
|
29
|
+
or
|
30
|
+
|
31
|
+
``` sh
|
32
|
+
$ cat send_message.rb
|
33
|
+
require "chatwork"
|
34
|
+
|
35
|
+
ChatWork::Message.create(room_id: 1234, body: "Hello, ChatWork!")
|
36
|
+
$ CHATWORK_API_TOKEN=xxx ruby send_message.rb
|
37
|
+
```
|
38
|
+
|
39
|
+
|
29
40
|
## Contributing
|
30
41
|
|
31
42
|
1. Fork it
|
@@ -16,7 +16,7 @@ module ChatWork
|
|
16
16
|
return APIConnectionError.new("Invalid response #{body}")
|
17
17
|
end
|
18
18
|
|
19
|
-
APIError.new(status, hash[
|
19
|
+
APIError.new(status, hash['errors'])
|
20
20
|
end
|
21
21
|
|
22
22
|
attr_reader :status
|
@@ -44,9 +44,9 @@ module ChatWork
|
|
44
44
|
class APIError < ChatWorkError
|
45
45
|
attr_reader :errors
|
46
46
|
|
47
|
-
def
|
48
|
-
@errors = error_response
|
49
|
-
super(error_response[
|
47
|
+
def initialize(status, error_response)
|
48
|
+
@errors = error_response
|
49
|
+
super(error_response[0], status, error_response)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
data/lib/chatwork/client.rb
CHANGED
@@ -24,7 +24,7 @@ module ChatWork
|
|
24
24
|
begin
|
25
25
|
JSON.parse(response.body)
|
26
26
|
rescue JSON::ParserError => e
|
27
|
-
raise ChatWork::APIConnectionError.new("Response JSON is broken. #{e.message}: #{response.body}")
|
27
|
+
raise ChatWork::APIConnectionError.new("Response JSON is broken. #{e.message}: #{response.body}", e)
|
28
28
|
end
|
29
29
|
else
|
30
30
|
ChatWork::ChatWorkError.from_response(response.status, response.body)
|
data/lib/chatwork/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chatwork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- asonas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -114,10 +114,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
version: '0'
|
115
115
|
requirements: []
|
116
116
|
rubyforge_project:
|
117
|
-
rubygems_version: 2.5.
|
117
|
+
rubygems_version: 2.5.1
|
118
118
|
signing_key:
|
119
119
|
specification_version: 4
|
120
120
|
summary: Ruby bindings of Chatwork API
|
121
121
|
test_files:
|
122
122
|
- spec/lib/chatwork_spec.rb
|
123
123
|
- spec/spec_helper.rb
|
124
|
+
has_rdoc:
|