Class: WebFunction::Argument
- Inherits:
-
Object
- Object
- WebFunction::Argument
- Defined in:
- lib/web_function/argument.rb
Overview
# Argument
Arguments used by Web Function endpoints to define its input parameters.
See the [arguments section] on the Web Function website for more details.
Instance Method Summary collapse
-
#choices ⇒ Array
## Choices.
-
#docs ⇒ String
## Docs.
-
#flags ⇒ Array<String>
## Flags.
-
#group ⇒ String
## Group.
-
#hint ⇒ String
## Hint.
-
#initialize(argument) ⇒ Argument
constructor
A new instance of Argument.
-
#name ⇒ String
## Name.
-
#type ⇒ String
## Type.
Constructor Details
#initialize(argument) ⇒ Argument
Returns a new instance of Argument.
13 14 15 |
# File 'lib/web_function/argument.rb', line 13 def initialize(argument) @argument = argument end |
Instance Method Details
#choices ⇒ Array
## Choices
An array specifying the exact, case-sensitive values that are permitted for this argument. Each value in the choices array must conform to the data type specified in the argument’s type key.
Note that if the argument type is array, choices may contain strings or numbers representing the allowed values that can be included in the array.
79 80 81 |
# File 'lib/web_function/argument.rb', line 79 def choices [*@argument["choices"]] end |
#docs ⇒ String
## Docs
Description of the argument. It must be formatted as markdown.
103 104 105 |
# File 'lib/web_function/argument.rb', line 103 def docs @argument["docs"].to_s end |
#flags ⇒ Array<String>
## Flags
List of argument flags. See the [available flags section] on the Web Function website for a complete list of flags available at the argument level.
93 94 95 |
# File 'lib/web_function/argument.rb', line 93 def flags [*@argument["flags"]].map { |flag| flag.to_s } end |
#group ⇒ String
## Group
A name used to categorize or group similar arguments together. This should be used by documentation tools to organize related arguments.
64 65 66 |
# File 'lib/web_function/argument.rb', line 64 def group @argument["group"] end |
#hint ⇒ String
## Hint
The hint of the argument
See the [hints section] on the Web Function website for the full list of possible hints.
53 54 55 |
# File 'lib/web_function/argument.rb', line 53 def hint @argument["hint"] end |
#name ⇒ String
## Name
The name of the argument.
23 24 25 |
# File 'lib/web_function/argument.rb', line 23 def name @argument["name"] end |
#type ⇒ String
## Type
The type of the argument. It must be one of:
- object
- array
- string
- number
- boolean
38 39 40 |
# File 'lib/web_function/argument.rb', line 38 def type @argument["type"] end |