lib/insales_api/app.rb in insales_api-0.1.3 vs lib/insales_api/app.rb in insales_api-0.2.0

- old
+ new

@@ -1,10 +1,11 @@ module InsalesApi class App class_attribute :api_key, :api_secret, :api_autologin_url, :api_host, :api_autologin_path, - :base_resource_class + :base_resource_class attr_reader :authorized, :domain, :password + self.base_resource_class = Base class << self def configure_api(domain, password) base_resource_class.configure(api_key, domain, password) @@ -16,19 +17,19 @@ domain.to_s.strip.downcase end alias_method :prepare_shop, :prepare_domain deprecate prepare_shop: :prepare_domain, - api_host: :api_autologin_url, - api_autologin_path: :api_autologin_url, - deprecator: Deprecator + api_host: :api_autologin_url, + api_autologin_path: :api_autologin_url, + deprecator: Deprecator - def install(domain, token, insales_id) + def install(domain, token, insales_id) # rubocop:disable Lint/UnusedMethodArgument true end - def uninstall(domain, password) + def uninstall(domain, password) # rubocop:disable Lint/UnusedMethodArgument true end def password_by_token(token) InsalesApi::Password.create(api_secret, token) @@ -44,16 +45,16 @@ def authorization_url host, port = domain, nil match = /(.+):(\d+)/.match host host, port = match[1..2] if match URI::Generic.build( - scheme: 'http', - host: host, - port: port && port.to_i, - path: "/admin/applications/#{api_key}/login", - query: { - token: salt, - login: api_autologin_url || "http://#{api_host}/#{api_autologin_path}", + scheme: 'http', + host: host, + port: port && port.to_i, + path: "/admin/applications/#{api_key}/login", + query: { + token: salt, + login: api_autologin_url || "http://#{api_host}/#{api_autologin_path}", }.to_query, ).to_s end def auth_token(salt = self.salt, user_email = '', user_name = '', user_id = '')