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.
2028 2029 2030 2031 2032 2033 |
# File 'lib/mockserver/models.rb', line 2028 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.
2026 2027 2028 |
# File 'lib/mockserver/models.rb', line 2026 def base_path @base_path end |
#id_field ⇒ Object
Returns the value of attribute id_field.
2026 2027 2028 |
# File 'lib/mockserver/models.rb', line 2026 def id_field @id_field end |
#id_strategy ⇒ Object
Returns the value of attribute id_strategy.
2026 2027 2028 |
# File 'lib/mockserver/models.rb', line 2026 def id_strategy @id_strategy end |
#initial_data ⇒ Object
Returns the value of attribute initial_data.
2026 2027 2028 |
# File 'lib/mockserver/models.rb', line 2026 def initial_data @initial_data end |
Class Method Details
.from_hash(data) ⇒ Object
2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 |
# File 'lib/mockserver/models.rb', line 2044 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
2035 2036 2037 2038 2039 2040 2041 2042 |
# File 'lib/mockserver/models.rb', line 2035 def to_h MockServer.strip_none({ 'basePath' => @base_path, 'idField' => @id_field, 'idStrategy' => @id_strategy, 'initialData' => @initial_data }) end |