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.
2262 2263 2264 2265 2266 2267 |
# File 'lib/mockserver/models.rb', line 2262 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.
2260 2261 2262 |
# File 'lib/mockserver/models.rb', line 2260 def base_path @base_path end |
#id_field ⇒ Object
Returns the value of attribute id_field.
2260 2261 2262 |
# File 'lib/mockserver/models.rb', line 2260 def id_field @id_field end |
#id_strategy ⇒ Object
Returns the value of attribute id_strategy.
2260 2261 2262 |
# File 'lib/mockserver/models.rb', line 2260 def id_strategy @id_strategy end |
#initial_data ⇒ Object
Returns the value of attribute initial_data.
2260 2261 2262 |
# File 'lib/mockserver/models.rb', line 2260 def initial_data @initial_data end |
Class Method Details
.from_hash(data) ⇒ Object
2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 |
# File 'lib/mockserver/models.rb', line 2278 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
2269 2270 2271 2272 2273 2274 2275 2276 |
# File 'lib/mockserver/models.rb', line 2269 def to_h MockServer.strip_none({ 'basePath' => @base_path, 'idField' => @id_field, 'idStrategy' => @id_strategy, 'initialData' => @initial_data }) end |