Module: Alchemrest::Data::Schema::ClassMethods

Defined in:
lib/alchemrest/data/schema.rb

Instance Method Summary collapse

Instance Method Details

#[]Object



66
67
68
# File 'lib/alchemrest/data/schema.rb', line 66

def []
  self::Collection
end

#capture_configurationObject



49
50
51
# File 'lib/alchemrest/data/schema.rb', line 49

def capture_configuration
  @capture_configuration ||= CaptureConfiguration.new(host_class: self)
end

#configure_response_captureObject



74
75
76
# File 'lib/alchemrest/data/schema.rb', line 74

def configure_response_capture(&)
  @capture_configuration = CaptureConfiguration.new(host_class: self, &)
end

#from_hash(hash) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/alchemrest/data/schema.rb', line 57

def from_hash(hash)
  transform_prelude = self::TRANSFORM.call(hash.deep_stringify_keys)
  if transform_prelude.right?
    transform_prelude.from_right
  else
    raise MorpherTransformError, transform_prelude.from_left
  end
end

#graphObject



70
71
72
# File 'lib/alchemrest/data/schema.rb', line 70

def graph
  self::GRAPH
end

#response_transformerObject



53
54
55
# File 'lib/alchemrest/data/schema.rb', line 53

def response_transformer
  Alchemrest::ResponseTransformers::Morpher.new(self::TRANSFORM)
end