chatwork 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1723fbfb198e843e9b5c80567a1964228fe0965
4
- data.tar.gz: ac436cace863cdea5bbd088275dbc70f8fd42521
3
+ metadata.gz: 0002230b882c6ce42c5ab7e35754175d54a2f5fc
4
+ data.tar.gz: 4e9e4fbf1d37fd2c5afce26b74edcf57dcab0307
5
5
  SHA512:
6
- metadata.gz: f7eebcff2d1a78d415605ef1ae15a0c0c19bf55d5a6d11382fc86862086c545d2b075ce24dd7bc985c17f6f6638f219c2d0f7d5673ee0d55502402826ff61bcc
7
- data.tar.gz: 45e5b7f05457aa03c6f9c22a79a394135e5e875972f7dac62ba9d80e7a95534a39280ab82fbd7bb094a4c707049e3222fea0b135680ec48d7c742ea2952925ff
6
+ metadata.gz: 650015698c78315f6e9271e5293f48aa003dcbf55737060ae14b5078ebd1181dc49d4a388f0b34fc1efbc0f739ae4dedfd718cc586b12a633476d30dfb831463
7
+ data.tar.gz: 3284b33fbd4553484dcf0d19f675e3f02e0248af7f54be4148fc3675cbcbfb0c770bf5f8dd9093ebde5866de6420502a14955a085bfa3f90fef309c79bf5ca82
data/chatwork.gemspec CHANGED
@@ -22,5 +22,5 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.3"
24
24
  spec.add_development_dependency "rake"
25
- spec.add_development_dependency "rspec", "~> 2.14.0"
25
+ spec.add_development_dependency "rspec", "~> 3.1.0"
26
26
  end
data/lib/chatwork.rb CHANGED
@@ -10,6 +10,7 @@ module ChatWork
10
10
  autoload(:Entity, 'chatwork/entity')
11
11
  autoload(:Message, 'chatwork/message')
12
12
  autoload(:Me, 'chatwork/me')
13
+ autoload(:Task, 'chatwork/task')
13
14
 
14
15
  @api_base = 'https://api.chatwork.com/'
15
16
  @api_version = '/v1'
@@ -3,13 +3,15 @@ module ChatWork
3
3
  class ChatWorkError < StandardError
4
4
 
5
5
  def self.from_response(status, body)
6
+ # HTTP status 204 don't have body.
7
+ return APIError.new(status, "") if status == 204
8
+
6
9
  hash =
7
10
  begin
8
11
  JSON.load(body)
9
12
  rescue JSON::ParserError => e
10
13
  return ChatWork::APIConnectionError.new("Response JSON is broken. #{e.message}: #{body}", e)
11
14
  end
12
-
13
15
  unless hash['errors']
14
16
  return APIConnectionError.new("Invalid response #{body}")
15
17
  end
@@ -18,6 +18,8 @@ module ChatWork
18
18
 
19
19
  def handle_response(response)
20
20
  case response.status
21
+ when 204
22
+ ChatWork::ChatWorkError.from_response(response.status, response.body)
21
23
  when 200..299
22
24
  begin
23
25
  JSON.parse(response.body)
@@ -0,0 +1,13 @@
1
+ module ChatWork
2
+ class Task < Entity
3
+ install_class_operations :get
4
+
5
+ def self.path
6
+ "/my/tasks"
7
+ end
8
+
9
+ def path
10
+ "/my/tasks"
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module ChatWork
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -2,12 +2,31 @@ require 'spec_helper'
2
2
  require 'chatwork'
3
3
 
4
4
  describe ChatWork do
5
- its(:client) { should be_a(ChatWork::Client) }
6
- its(:api_base) { should eq('https://api.chatwork.com/') }
5
+ describe '#client' do
6
+ subject { super().client }
7
+ it { should be_a(ChatWork::Client) }
8
+ end
9
+
10
+ describe '#api_base' do
11
+ subject { super().api_base }
12
+ it { should eq('https://api.chatwork.com/') }
13
+ end
7
14
  describe '#api_base=' do
8
- before { subject.api_base = 'https://test.example.com/' }
9
- its(:api_base) { should eq('https://test.example.com/') }
10
- its(:api_base) { should eq('https://test.example.com/') }
15
+ before { ChatWork.api_base = 'https://test.example.com/' }
16
+
17
+ describe '#api_base' do
18
+ subject { super().api_base }
19
+ it { should eq('https://test.example.com/') }
20
+ end
21
+
22
+ describe '#api_base' do
23
+ subject { super().api_base }
24
+ it { should eq('https://test.example.com/') }
25
+ end
26
+ end
27
+
28
+ describe '#api_key' do
29
+ subject { super().api_key }
30
+ it { should be_nil }
11
31
  end
12
- its(:api_key) { should be_nil }
13
32
  end
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.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - asonas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-20 00:00:00.000000000 Z
11
+ date: 2014-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 2.14.0
61
+ version: 3.1.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 2.14.0
68
+ version: 3.1.0
69
69
  description: ChatWork is cloud-based business chat tool
70
70
  email:
71
71
  - hzw1258@gmail.com
@@ -87,6 +87,7 @@ files:
87
87
  - lib/chatwork/message.rb
88
88
  - lib/chatwork/operations.rb
89
89
  - lib/chatwork/room.rb
90
+ - lib/chatwork/task.rb
90
91
  - lib/chatwork/version.rb
91
92
  - spec/lib/chatwork_spec.rb
92
93
  - spec/spec_helper.rb
@@ -117,4 +118,3 @@ summary: Ruby bindings of Chatwork API
117
118
  test_files:
118
119
  - spec/lib/chatwork_spec.rb
119
120
  - spec/spec_helper.rb
120
- has_rdoc: