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.
1477 1478 1479 1480 1481 1482 |
# File 'lib/mockserver/models.rb', line 1477 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.
1475 1476 1477 |
# File 'lib/mockserver/models.rb', line 1475 def base_path @base_path end |
#id_field ⇒ Object
Returns the value of attribute id_field.
1475 1476 1477 |
# File 'lib/mockserver/models.rb', line 1475 def id_field @id_field end |
#id_strategy ⇒ Object
Returns the value of attribute id_strategy.
1475 1476 1477 |
# File 'lib/mockserver/models.rb', line 1475 def id_strategy @id_strategy end |
#initial_data ⇒ Object
Returns the value of attribute initial_data.
1475 1476 1477 |
# File 'lib/mockserver/models.rb', line 1475 def initial_data @initial_data end |
Class Method Details
.from_hash(data) ⇒ Object
1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 |
# File 'lib/mockserver/models.rb', line 1493 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
1484 1485 1486 1487 1488 1489 1490 1491 |
# File 'lib/mockserver/models.rb', line 1484 def to_h MockServer.strip_none({ 'basePath' => @base_path, 'idField' => @id_field, 'idStrategy' => @id_strategy, 'initialData' => @initial_data }) end |