chatwork 0.6.1 → 0.6.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59e4ff9379d4a6103a888096f95051bde6b365ad9e7a165f379563f95a14042d
4
- data.tar.gz: 90709b0cd1ea756266fb6072cd656455bc929ed34870dcf3d889781cb29f740a
3
+ metadata.gz: 52031d9d56999ff66bad2a4617fb83027540f1f32dd17a5bfa9d6920a94aaf9e
4
+ data.tar.gz: 90555909fa6e8990000d9c4eef8fd94e599a01b0a647a20ca09135b0bb65d435
5
5
  SHA512:
6
- metadata.gz: ee3317f8e4afbf7d4c8a6384562202e8d8ce68226e7ccab6e6fc806446b0548df0a1192b5b712ed879a16de4d7bc2aca5dda15f87a596f4f479c62655787a945
7
- data.tar.gz: 438dc9cec86531f6be5abb10f824d3a91c9bb0a22078027fb999e2ad19745fe6f67e4b039d14fa43680f4aa39ada8f9aacc71ebb701b980713fe9da51f3a066d
6
+ metadata.gz: 4bfdc23a78474cd708e33b97d906ed6ada4aefa15d1028e85826a501efbe02aa5e5567fd69d8fd25faf1ee4a28661a994a13474a50e51d007eee1ab8c2b7ba0c
7
+ data.tar.gz: 5eb280a4f59d87e467f33510f0d6ee799eed7d1e10e49b72c3dd5d7e48eb7748578e605510fc390143409cb50aee8970ccf8108f67c48dfabb1bb38cf810258d
@@ -1,6 +1,14 @@
1
1
  # Change Log
2
2
  ## Unreleased
3
- [Full Changelog](https://github.com/asonas/chatwork-ruby/compare/v0.6.1...master)
3
+ [Full Changelog](https://github.com/asonas/chatwork-ruby/compare/v0.6.2...master)
4
+
5
+ ## v0.6.2
6
+ [Full Changelog](https://github.com/asonas/chatwork-ruby/compare/v0.6.1...v0.6.2)
7
+
8
+ * Fixed. `NoMethodError` when error response is empty
9
+ * https://github.com/asonas/chatwork-ruby/pull/43
10
+ * Fixed. uninitialized constant `ChatWork::AuthenticateError` when other error class has not been called at all
11
+ * https://github.com/asonas/chatwork-ruby/pull/45
4
12
 
5
13
  ## v0.6.1
6
14
  [Full Changelog](https://github.com/asonas/chatwork-ruby/compare/v0.6.0...v0.6.1)
@@ -5,6 +5,7 @@ module ChatWork
5
5
  autoload :BaseClient, "chatwork/base_client"
6
6
  autoload :APIConnectionError, "chatwork/chatwork_error"
7
7
  autoload :APIError, "chatwork/chatwork_error"
8
+ autoload :AuthenticateError, "chatwork/chatwork_error"
8
9
  autoload :ChatWorkError, "chatwork/chatwork_error"
9
10
  autoload :Client, "chatwork/client"
10
11
  autoload :Contacts, "chatwork/contacts"
@@ -1,6 +1,8 @@
1
1
  module ChatWork
2
2
  class ChatWorkError < StandardError
3
3
  def self.from_response(status, body, headers)
4
+ body ||= {}
5
+
4
6
  if headers.has_key?("WWW-Authenticate")
5
7
  return AuthenticateError.from_www_authenticate(
6
8
  www_authenticate: headers["WWW-Authenticate"],
@@ -42,11 +42,11 @@ module ChatWork
42
42
  # @return [Hashie::Mash]
43
43
  #
44
44
  # @example response format
45
- # {
46
- # "admin": [123, 542, 1001],
47
- # "member": [10, 103],
48
- # "readonly": [6, 11]
49
- # }
45
+ # {
46
+ # "admin": [123, 542, 1001],
47
+ # "member": [10, 103],
48
+ # "readonly": [6, 11]
49
+ # }
50
50
  def self.update_all(room_id:, members_admin_ids:, members_member_ids: nil, members_readonly_ids: nil)
51
51
  params = {
52
52
  members_admin_ids: Array(members_admin_ids).join(","),
@@ -1,3 +1,3 @@
1
1
  module ChatWork
2
- VERSION = "0.6.1".freeze
2
+ VERSION = "0.6.2".freeze
3
3
  end
@@ -1,6 +1,8 @@
1
1
  describe ChatWork::ChatWorkError do
2
2
  describe ".from_response" do
3
- subject { ChatWork::ChatWorkError.from_response(status, Hashie::Mash.new(body), headers) }
3
+ subject { ChatWork::ChatWorkError.from_response(status, body_mash, headers) }
4
+
5
+ let(:body_mash) { Hashie::Mash.new(body) }
4
6
 
5
7
  context "with WWW-Authenticate header" do
6
8
  let(:status) { 401 }
@@ -42,6 +44,14 @@ describe ChatWork::ChatWorkError do
42
44
  its(:error_description) { should eq "The client ID `client_id` is unknown." }
43
45
  its(:error_response) { should eq body }
44
46
  end
47
+
48
+ context "when body is nil" do
49
+ let(:status) { 401 }
50
+ let(:body_mash) { nil }
51
+ let(:headers) { {} }
52
+
53
+ it { should be_an_instance_of ChatWork::APIConnectionError }
54
+ end
45
55
  end
46
56
 
47
57
  describe ChatWork::AuthenticateError do
@@ -5,7 +5,7 @@ RSpec.describe RamlParser do
5
5
  let(:verb) { :get }
6
6
  let(:path) { "/rooms/{room_id}/members" }
7
7
 
8
- its(["description"]) { should eq "チャットのメンバー一覧を取得\n" }
8
+ its(["description"]) { should eq "チャットのメンバー一覧を取得" }
9
9
  its(["is"]) { should eq ["room_member_list_response", "unauthorized_response"] }
10
10
  end
11
11
 
@@ -1,6 +1,13 @@
1
1
  if ENV["CI"]
2
+ require "simplecov"
2
3
  require "coveralls"
3
- Coveralls.wear!
4
+
5
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
6
+ SimpleCov.start do
7
+ %w[spec].each do |ignore_path|
8
+ add_filter(ignore_path)
9
+ end
10
+ end
4
11
  end
5
12
 
6
13
  $LOAD_PATH << File.expand_path(File.join("..", "..", "lib"), __FILE__)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chatwork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - asonas
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-01-12 00:00:00.000000000 Z
12
+ date: 2018-01-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -331,7 +331,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
331
331
  version: '0'
332
332
  requirements: []
333
333
  rubyforge_project:
334
- rubygems_version: 2.7.3
334
+ rubygems_version: 2.7.4
335
335
  signing_key:
336
336
  specification_version: 4
337
337
  summary: Ruby bindings of ChatWork API