Class: Composio::Time

Inherits:
Object
  • Object
show all
Defined in:
lib/composio/models/time.rb

Constant Summary collapse

N5M =
"5m".freeze
N30M =
"30m".freeze
N6H =
"6h".freeze
N1D =
"1d".freeze
N1W =
"1w".freeze
N1MONTH =
"1month".freeze
N1Y =
"1y".freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all_varsObject



22
23
24
# File 'lib/composio/models/time.rb', line 22

def self.all_vars
  @all_vars ||= [N5M, N30M, N6H, N1D, N1W, N1MONTH, N1Y].freeze
end

.build_from_hash(value) ⇒ String

Builds the enum from string

Parameters:

  • The (String)

    enum value in the form of the string

Returns:

  • (String)

    The enum value



29
30
31
# File 'lib/composio/models/time.rb', line 29

def self.build_from_hash(value)
  new.build_from_hash(value)
end

Instance Method Details

#build_from_hash(value) ⇒ String

Builds the enum from string

Parameters:

  • The (String)

    enum value in the form of the string

Returns:

  • (String)

    The enum value



36
37
38
39
# File 'lib/composio/models/time.rb', line 36

def build_from_hash(value)
  return value if Time.all_vars.include?(value)
  raise "Invalid ENUM value #{value} for class #Time"
end