Class: Apiwork::Introspection::API::Info::License

Inherits:
Object
  • Object
show all
Defined in:
lib/apiwork/introspection/api/info/license.rb

Overview

Wraps API license information.

Examples:

license = api.info.license
license.name # => "MIT"
license.url # => "https://opensource.org/licenses/MIT"

Instance Method Summary collapse

Constructor Details

#initialize(dump) ⇒ License

Returns a new instance of License.



15
16
17
# File 'lib/apiwork/introspection/api/info/license.rb', line 15

def initialize(dump)
  @dump = dump
end

Instance Method Details

#nameString?

The license name.

Returns:

  • (String, nil)


23
24
25
# File 'lib/apiwork/introspection/api/info/license.rb', line 23

def name
  @dump[:name]
end

#to_hHash

Converts this license to a hash.

Returns:

  • (Hash)


39
40
41
42
43
44
# File 'lib/apiwork/introspection/api/info/license.rb', line 39

def to_h
  {
    name: name,
    url: url,
  }
end

#urlString?

The license URL.

Returns:

  • (String, nil)


31
32
33
# File 'lib/apiwork/introspection/api/info/license.rb', line 31

def url
  @dump[:url]
end