diff --git a/Gemfile.lock b/Gemfile.lock index 28c3300..353a30d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,8 +1,8 @@ PATH remote: . specs: - ZCRMSDK (0.1.0) - json (~> 1.8) + ZCRMSDK (1.0.1) + json (~> 2.2) multipart-post (~> 2.0) rest-client (~> 2.0) @@ -10,18 +10,21 @@ GEM remote: https://rubygems.org/ specs: diff-lcs (1.3) - domain_name (0.5.20180417) + domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) + http-accept (1.7.0) http-cookie (1.0.3) domain_name (~> 0.5) - json (1.8.3.1) - mime-types (3.2.2) + json (2.2.0) + mime-types (3.3) mime-types-data (~> 3.2015) - mime-types-data (3.2019.0331) + mime-types-data (3.2019.1009) multipart-post (2.1.1) + mysql2 (0.5.2) netrc (0.11.0) rake (10.5.0) - rest-client (2.0.2) + rest-client (2.1.0) + http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) @@ -48,6 +51,7 @@ PLATFORMS DEPENDENCIES ZCRMSDK! bundler (~> 2.0) + mysql2 (~> 0.5.2) rake (~> 10.0) rspec (~> 3.0) diff --git a/ZCRMSDK.gemspec b/ZCRMSDK.gemspec index cb74f3c..2a6258f 100644 --- a/ZCRMSDK.gemspec +++ b/ZCRMSDK.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'bundler', '~> 2.0' spec.add_runtime_dependency 'multipart-post', '~> 2.0' spec.add_runtime_dependency 'rest-client', '~> 2.0' - spec.add_runtime_dependency 'json', '~> 1.8' + spec.add_runtime_dependency 'json', '~> 2.2' spec.add_development_dependency 'rake', '~> 10.0' spec.add_development_dependency 'rspec', '~> 3.0' spec.add_development_dependency 'mysql2', '~> 0.5.2' diff --git a/lib/ZCRMSDK/persistence.rb b/lib/ZCRMSDK/persistence.rb index d07717d..70b3dba 100644 --- a/lib/ZCRMSDK/persistence.rb +++ b/lib/ZCRMSDK/persistence.rb @@ -72,8 +72,9 @@ def save_oauth_tokens(oauth_tokens) file_obj.close arr = Marshal.load(serialized) unless serialized.nil? || serialized.empty? arr.push(oauth_tokens) - file_obj = File.open(path, 'w+') - file_obj.write(Marshal.dump(arr)) + marshalled_tokens = Marshal.dump(arr) + file_obj = File.open(path, "w:#{marshalled_tokens.encoding.to_s}") + file_obj.write(marshalled_tokens) file_obj.close end diff --git a/lib/ZCRMSDK/utility.rb b/lib/ZCRMSDK/utility.rb index 612d897..5e265de 100644 --- a/lib/ZCRMSDK/utility.rb +++ b/lib/ZCRMSDK/utility.rb @@ -304,6 +304,13 @@ def initialize(url, status_code, err_message, exception_code = 'error', details def self.get_instance(url, status_code, err_message, exception_code = 'error', details = nil, content = nil) ZCRMException.new(url, status_code, err_message, exception_code, details, content) end + + def to_s + "#{self.class}\n#{exception.url}\n#{exception.status_code}"\ + "- #{exception.error_message}\n"\ + "#{exception.exception_code}\n#{error_details}\n#{error_content}" + end + end end end diff --git a/lib/ZCRMSDK/version.rb b/lib/ZCRMSDK/version.rb index f2c1ca5..dc57155 100644 --- a/lib/ZCRMSDK/version.rb +++ b/lib/ZCRMSDK/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module ZCRMSDK - VERSION = '1.0.0' + VERSION = '1.0.2' end