Class: MockServer::CrudExpectationsDefinition
- Inherits:
-
Object
- Object
- MockServer::CrudExpectationsDefinition
- Defined in:
- lib/mockserver/models.rb
Instance Attribute Summary collapse
-
#base_path ⇒ Object
Returns the value of attribute base_path.
-
#id_field ⇒ Object
Returns the value of attribute id_field.
-
#id_strategy ⇒ Object
Returns the value of attribute id_strategy.
-
#initial_data ⇒ Object
Returns the value of attribute initial_data.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(base_path: '', id_field: 'id', id_strategy: 'AUTO_INCREMENT', initial_data: nil) ⇒ CrudExpectationsDefinition
constructor
A new instance of CrudExpectationsDefinition.
- #to_h ⇒ Object
Constructor Details
#initialize(base_path: '', id_field: 'id', id_strategy: 'AUTO_INCREMENT', initial_data: nil) ⇒ CrudExpectationsDefinition
Returns a new instance of CrudExpectationsDefinition.
1993 1994 1995 1996 1997 1998 |
# File 'lib/mockserver/models.rb', line 1993 def initialize(base_path: '', id_field: 'id', id_strategy: 'AUTO_INCREMENT', initial_data: nil) @base_path = base_path @id_field = id_field @id_strategy = id_strategy @initial_data = initial_data end |
Instance Attribute Details
#base_path ⇒ Object
Returns the value of attribute base_path.
1991 1992 1993 |
# File 'lib/mockserver/models.rb', line 1991 def base_path @base_path end |
#id_field ⇒ Object
Returns the value of attribute id_field.
1991 1992 1993 |
# File 'lib/mockserver/models.rb', line 1991 def id_field @id_field end |
#id_strategy ⇒ Object
Returns the value of attribute id_strategy.
1991 1992 1993 |
# File 'lib/mockserver/models.rb', line 1991 def id_strategy @id_strategy end |
#initial_data ⇒ Object
Returns the value of attribute initial_data.
1991 1992 1993 |
# File 'lib/mockserver/models.rb', line 1991 def initial_data @initial_data end |
Class Method Details
.from_hash(data) ⇒ Object
2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 |
# File 'lib/mockserver/models.rb', line 2009 def self.from_hash(data) return nil if data.nil? new( base_path: data.fetch('basePath', ''), id_field: data.fetch('idField', 'id'), id_strategy: data.fetch('idStrategy', 'AUTO_INCREMENT'), initial_data: data['initialData'] ) end |
Instance Method Details
#to_h ⇒ Object
2000 2001 2002 2003 2004 2005 2006 2007 |
# File 'lib/mockserver/models.rb', line 2000 def to_h MockServer.strip_none({ 'basePath' => @base_path, 'idField' => @id_field, 'idStrategy' => @id_strategy, 'initialData' => @initial_data }) end |