Class: Useless::Doc::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/useless/doc/resource.rb

Overview

Documentation for an API resource.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Resource

Returns a new instance of Resource.

Parameters:

  • attrs (Hash) (defaults to: {})

    corresponds to the class’s instance attributes.



22
23
24
25
26
# File 'lib/useless/doc/resource.rb', line 22

def initialize(attrs = {})
  @path         = attrs[:path]
  @description  = attrs[:description]
  @actions      = attrs[:actions]
end

Instance Attribute Details

#actionsArray<Action> (readonly)

Returns documentation for the available actions for the resource.

Returns:

  • (Array<Action>)

    documentation for the available actions for the resource.



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/useless/doc/resource.rb', line 16

class Resource

  attr_reader :path, :description, :actions

  # @param [Hash] attrs corresponds to the class's instance attributes.
  #
  def initialize(attrs = {})
    @path         = attrs[:path]
    @description  = attrs[:description]
    @actions      = attrs[:actions]
  end
end

#descriptionString (readonly)

Returns a description of the resource.

Returns:

  • (String)

    a description of the resource.



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/useless/doc/resource.rb', line 16

class Resource

  attr_reader :path, :description, :actions

  # @param [Hash] attrs corresponds to the class's instance attributes.
  #
  def initialize(attrs = {})
    @path         = attrs[:path]
    @description  = attrs[:description]
    @actions      = attrs[:actions]
  end
end

#pathString (readonly)

Returns the path segment of the resource URL.

Returns:

  • (String)

    the path segment of the resource URL.



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/useless/doc/resource.rb', line 16

class Resource

  attr_reader :path, :description, :actions

  # @param [Hash] attrs corresponds to the class's instance attributes.
  #
  def initialize(attrs = {})
    @path         = attrs[:path]
    @description  = attrs[:description]
    @actions      = attrs[:actions]
  end
end