Skip to content

Commit ae064bb

Browse files
committed
Remove multi_json dependency.
1 parent e78925e commit ae064bb

5 files changed

Lines changed: 8 additions & 32 deletions

File tree

github_api.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Gem::Specification.new do |gem|
2020
gem.add_dependency 'addressable', '~> 2.4.0'
2121
gem.add_dependency 'hashie', '>= 3.4'
2222
gem.add_dependency 'faraday', '~> 0.8', '< 0.10'
23-
gem.add_dependency 'multi_json', '>= 1.7.5', '< 2.0'
2423
gem.add_dependency 'oauth2'
2524
gem.add_dependency 'descendants_tracker', '~> 0.0.4'
2625

lib/github_api/error/service_error.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# encoding: utf-8
2-
# require 'multi_json'
3-
require 'github_api/jsonable'
2+
3+
require 'json'
44

55
module Github
66
# Raised when GitHub returns any of the HTTP status codes
77
module Error
88
class ServiceError < GithubError
9-
include ::Github::Jsonable
109

1110
attr_reader :http_headers, :body, :status
1211

@@ -26,7 +25,7 @@ def parse_response(response)
2625

2726
def decode_body(body)
2827
if body.respond_to?(:to_str) && body.length >= MIN_BODY_LENGTH
29-
decode body, symbolize_keys: true
28+
JSON.parse(body, symbolize_names: true)
3029
else
3130
body
3231
end
@@ -62,7 +61,6 @@ def self.errors
6261
descendants.map { |klass| [klass.new({}).http_status_code, klass] }
6362
]
6463
end
65-
66-
end
64+
end # ServiceError
6765
end # Error
6866
end # Github

lib/github_api/jsonable.rb

Lines changed: 0 additions & 18 deletions
This file was deleted.

lib/github_api/response/jsonize.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
# encoding: utf-8
22

33
require 'faraday'
4-
require 'github_api/jsonable'
4+
require 'json'
55

66
module Github
77
class Response::Jsonize < Response
8-
include Github::Jsonable
98

10-
dependency 'multi_json'
9+
dependency 'json'
1110

1211
define_parser do |body|
13-
Github::Jsonable.decode body
12+
JSON.parse(body)
1413
end
1514

1615
def parse(body)
@@ -22,7 +21,7 @@ def parse(body)
2221
when 'false'
2322
false
2423
else
25-
self.class.parser.call body
24+
self.class.parser.call(body)
2625
end
2726
end
2827
end # Response::Jsonize

spec/github/client/repos/list_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
require 'spec_helper'
44

55
describe Github::Client::Repos, '#list' do
6-
include Github::Jsonable
7-
86
let(:user) { 'peter-murach' }
97
let(:repo) { 'github' }
108
let(:request_path) { "/user/repos?access_token=#{OAUTH_TOKEN}" }

0 commit comments

Comments
 (0)