Commit 808a3bbc authored by Oleksandr's avatar Oleksandr 🎱

fix options

parent 980cbbad
...@@ -17,14 +17,16 @@ module Wedoops ...@@ -17,14 +17,16 @@ module Wedoops
} }
def initialize(options={}) def initialize(options={})
@options = Hash.new
# environment specific settings # environment specific settings
if options.has_key?(:environment) && options[:environment] == "sandbox" if options.has_key?(:environment) && options[:environment] == "sandbox"
self.class.base_uri "https://sandbox.zohoapis.com/oauth/v2/" self.class.base_uri "https://sandbox.zohoapis.com/oauth/v2/"
options.delete(:environment)
@options[:environment] = "sandbox"
end end
#build_url(options) #build_url(options)
@logger = ::Logger.new(STDOUT) @logger = ::Logger.new(STDOUT)
@options = Hash.new
options.merge!({response_type: 'code',access_type: 'offline',redirect_uri: 'http://localhost:8000/auth/callback'}) options.merge!({response_type: 'code',access_type: 'offline',redirect_uri: 'http://localhost:8000/auth/callback'})
@grant_token = options[:grant_token] @grant_token = options[:grant_token]
#@options.merge!(grant_token: options[:grant_token] ) #@options.merge!(grant_token: options[:grant_token] )
......
...@@ -8,7 +8,8 @@ module Wedoops ...@@ -8,7 +8,8 @@ module Wedoops
def initialize(options={}) def initialize(options={})
# environment specific settings # environment specific settings
if options.has_key?(:environment) && options[:environment] == "sandbox" if options.has_key?(:environment) && options[:environment] == "sandbox"
self.class.base_url "https://sandbox.zohoapis.com/oauth/v2/" self.class.base_uri "https://sandbox.zohoapis.com/oauth/v2/"
options.delete(:environment)
end end
@logger = ::Logger.new(STDOUT) @logger = ::Logger.new(STDOUT)
...@@ -29,4 +30,4 @@ module Wedoops ...@@ -29,4 +30,4 @@ module Wedoops
end end
end end
end end
\ No newline at end of file
...@@ -16,6 +16,7 @@ module Wedoops ...@@ -16,6 +16,7 @@ module Wedoops
# environment specific settings # environment specific settings
if options.has_key?(:environment) && options[:environment] == "sandbox" if options.has_key?(:environment) && options[:environment] == "sandbox"
self.class.base_uri "https://sandbox.zohoapis.com/oauth/v2/" self.class.base_uri "https://sandbox.zohoapis.com/oauth/v2/"
options.delete(:environment)
end end
options.merge!(grant_type: "refresh_token") options.merge!(grant_type: "refresh_token")
......
...@@ -26,6 +26,7 @@ module Wedoops ...@@ -26,6 +26,7 @@ module Wedoops
@token = nil @token = nil
@token_payload = nil @token_payload = nil
@token_expires = DateTime.now @token_expires = DateTime.now
@logger.debug("init client: #{@options}")
end end
def login? def login?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment