Class: Factorix::API::License
- Inherits:
-
Data
- Object
- Data
- Factorix::API::License
- Defined in:
- lib/factorix/api/license.rb,
lib/factorix/api/license.rb
Overview
License object from MOD Portal API
Represents a MOD license information. Also provides valid license identifiers for edit_details API.
Instance Attribute Summary collapse
-
#description ⇒ String
readonly
License description (long text).
-
#id ⇒ String
readonly
License ID.
-
#name ⇒ String
readonly
License name.
-
#title ⇒ String
readonly
License title.
-
#url ⇒ URI::HTTPS
readonly
License URL.
Class Method Summary collapse
-
.identifier_values ⇒ Array<String>
List all valid license identifier values.
-
.valid_identifier?(value) ⇒ Boolean
Check if the given value is a valid license identifier.
Instance Method Summary collapse
-
#initialize(id:, name:, title:, description:, url:) ⇒ License
constructor
Create License from API response hash.
Constructor Details
#initialize(id:, name:, title:, description:, url:) ⇒ License
Create License from API response hash
65 66 67 68 |
# File 'lib/factorix/api/license.rb', line 65 def initialize(id:, name:, title:, description:, url:) url = URI(url) super end |
Instance Attribute Details
#description ⇒ String (readonly)
Returns license description (long text).
17 18 19 |
# File 'lib/factorix/api/license.rb', line 17 def description @description end |
#id ⇒ String (readonly)
Returns license ID.
17 18 19 |
# File 'lib/factorix/api/license.rb', line 17 def id @id end |
#name ⇒ String (readonly)
Returns license name.
17 18 19 |
# File 'lib/factorix/api/license.rb', line 17 def name @name end |
#title ⇒ String (readonly)
Returns license title.
17 18 19 |
# File 'lib/factorix/api/license.rb', line 17 def title @title end |
#url ⇒ URI::HTTPS (readonly)
Returns license URL.
17 18 19 |
# File 'lib/factorix/api/license.rb', line 17 def url @url end |
Class Method Details
.identifier_values ⇒ Array<String>
List all valid license identifier values
55 |
# File 'lib/factorix/api/license.rb', line 55 def self.identifier_values = IDENTIFIERS.keys |
.valid_identifier?(value) ⇒ Boolean
Check if the given value is a valid license identifier
48 49 50 |
# File 'lib/factorix/api/license.rb', line 48 def self.valid_identifier?(value) IDENTIFIERS.key?(value) || CUSTOM_LICENSE_PATTERN.match?(value) end |