Class: Sketchup::Licensing::ExtensionLicense

Inherits:
Object
  • Object
show all

Overview

The Sketchup::Licensing::ExtensionLicense class is used to store extension license information. An instance of this class is returned by Sketchup::Licensing.get_extension_license. Note that this is a temporary object representing the extension licensing state for the moment it was returned. It will not reflect any licensing state changes that may occur.

Version:

  • SketchUp 2015

Instance Method Summary # collapse

Instance Method Details

#days_remainingObject

The days_remaining method is used to get the number of days remaining until license expiration.

Examples:

ext_id = "4e215280-dd23-40c4-babb-b8a8dd29d5ee"
ext_lic = Sketchup::Licensing.get_extension_license(ext_id)
if ext_lic.days_remaining != 0
   puts "The license will expire in #{ext_lic.days_remaining} days."
end

Returns:

  • Integer - Number of days until license expiration. Zero if a permanent license or not licensed.

Version:

  • SketchUp 2015

#error_descriptionObject

The error_description method is used to obtain error information in case of failure to acquire a license. This is meant to aid in debugging only. Extensions should not rely on any exact error description.

Examples:

ext_id = "4e215280-dd23-40c4-babb-b8a8dd29d5ee"
ext_lic = Sketchup::Licensing.get_extension_license(ext_id)
if !ext_lic.licensed?
   puts ext_lic.error_description
end

Returns:

  • String - error description.

Version:

  • SketchUp 2015

#licensed?Object

The licensed? method is used to decide whether the extension is licensed to run or not.

Examples:

ext_id = "4e215280-dd23-40c4-babb-b8a8dd29d5ee"
ext_lic = Sketchup::Licensing.get_extension_license(ext_id)
if ext_lic.licensed?
   puts "Extension is licensed."
end

Returns:

  • Boolean - true if the extension is allowed to run, false if it is not licensed and should quit.

  • (Boolean)

Version:

  • SketchUp 2015

#stateObject

The state method returns a constant indicating the specific licensing state. These should be used for informational purposes only and not to decide if the extension is licensed to run. For that, please use the licensed? method.

Examples:

ext_id = "4e215280-dd23-40c4-babb-b8a8dd29d5ee"
ext_lic = Sketchup::Licensing.get_extension_license(ext_id)
if ext_lic.state == Sketchup::Licensing::TRIAL_EXPIRED
   puts "Trial period has expired."
end

Returns:

  • Integer - One of Sketchup::Licensing::LICENSED, Sketchup::Licensing::EXPIRED, Sketchup::Licensing::TRIAL, Sketchup::Licensing::TRIAL_EXPIRED, Sketchup::Licensing::NOT_LICENSED

Version:

  • SketchUp 2015