class Safrano::FunctionImport::ResultDefinition

Constants

COLLECTION
D
DJ_CLOSE
DJ_OPEN
METAK
RESULTSK
TYPEK
VALUEK

Public Class Methods

asComplexType(klassmod) click to toggle source

return a subclass of ResultAsComplexType

# File lib/odata/complex_type.rb, line 30
def self.asComplexType(klassmod)
  Class.new(ResultAsComplexType) do
    @klassmod = klassmod
  end
end
asComplexTypeColl(klassmod) click to toggle source

return a subclass of ResultAsComplexType

# File lib/odata/complex_type.rb, line 37
def self.asComplexTypeColl(klassmod)
  Class.new(ResultAsComplexTypeColl) do
    @klassmod = klassmod
  end
end
asEntity(klassmod) click to toggle source
# File lib/odata/complex_type.rb, line 55
def self.asEntity(klassmod)
  Class.new(ResultAsEntity) do
    @klassmod = klassmod
  end
end
asEntityColl(klassmod) click to toggle source
# File lib/odata/complex_type.rb, line 61
def self.asEntityColl(klassmod)
  Class.new(ResultAsEntityColl) do
    @klassmod = klassmod
  end
end
asPrimitiveType(klassmod) click to toggle source
# File lib/odata/complex_type.rb, line 43
def self.asPrimitiveType(klassmod)
  Class.new(ResultAsPrimitiveType) do
    @klassmod = klassmod
  end
end
asPrimitiveTypeColl(klassmod) click to toggle source
# File lib/odata/complex_type.rb, line 49
def self.asPrimitiveTypeColl(klassmod)
  Class.new(ResultAsPrimitiveTypeColl) do
    @klassmod = klassmod
  end
end
do_execute_func_result(result, _req, apply_query_params = false) click to toggle source

wrapper for OData Entity and Collections, return them directly for others, ie ComplexType, Prims etc, return the ResultDefinition-subclass wrapped result

# File lib/odata/complex_type.rb, line 91
def self.do_execute_func_result(result, _req, apply_query_params = false)
  self.new(result)
end
klassmod() click to toggle source

we will have this on class and instance level for making things simpler first

# File lib/odata/complex_type.rb, line 25
def self.klassmod
  @klassmod
end
new(value) click to toggle source
# File lib/odata/complex_type.rb, line 67
def initialize(value)
  @value = value
end
type_metadata() click to toggle source
# File lib/odata/complex_type.rb, line 75
def self.type_metadata
  @klassmod.type_name
end

Public Instance Methods

allowed_transitions() click to toggle source
# File lib/odata/complex_type.rb, line 16
def allowed_transitions
  [Safrano::TransitionEnd]
end
odata_get(req) click to toggle source
# File lib/odata/complex_type.rb, line 71
def odata_get(req)
  [200, EMPTY_HASH, [to_odata_json(req)]]
end
to_odata_json(_req) click to toggle source

needed for ComplexType result

# File lib/odata/complex_type.rb, line 84
def to_odata_json(_req)
  "#{DJ_OPEN}#{@value.odata_h.to_json}#{DJ_CLOSE}"
end
transition_end(_match_result) click to toggle source
# File lib/odata/complex_type.rb, line 20
def transition_end(_match_result)
  Safrano::Transition::RESULT_END
end
type_metadata() click to toggle source
# File lib/odata/complex_type.rb, line 79
def type_metadata
  self.class.type_metadata
end