Class: Io::Flow::V0::Models::QueryType

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ QueryType

Returns a new instance of QueryType.



13846
13847
13848
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13846

def initialize(value)
  @value = HttpClient::Preconditions.assert_class('value', value, String)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13844
13845
13846
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13844

def value
  @value
end

Class Method Details

.ALLObject



13866
13867
13868
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13866

def QueryType.ALL
  @@all ||= [QueryType.exclusion, QueryType.inclusion]
end

.apply(value) ⇒ Object

Returns the instance of QueryType for this value, creating a new instance for an unknown value



13851
13852
13853
13854
13855
13856
13857
13858
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13851

def QueryType.apply(value)
  if value.instance_of?(QueryType)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || QueryType.new(value))
  end
end

.exclusionObject

Exclude items satisfied by the associated query



13871
13872
13873
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13871

def QueryType.exclusion
  @@_exclusion ||= QueryType.new('exclusion')
end

.from_string(value) ⇒ Object

Returns the instance of QueryType for this value, or nil if not found



13861
13862
13863
13864
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13861

def QueryType.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  QueryType.ALL.find { |v| v.value == value }
end

.inclusionObject

Include items satisfied by the associated query



13876
13877
13878
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13876

def QueryType.inclusion
  @@_inclusion ||= QueryType.new('inclusion')
end

Instance Method Details

#to_hashObject



13880
13881
13882
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13880

def to_hash
  value
end