Class: OdataDuty::SchemaBuilder::EntitySet
- Defined in:
- lib/odata_duty/schema_builder/entity_set.rb
Instance Attribute Summary collapse
-
#entity_type ⇒ Object
readonly
Returns the value of attribute entity_type.
-
#init_args ⇒ Object
readonly
Returns the value of attribute init_args.
-
#resolver ⇒ Object
readonly
Returns the value of attribute resolver.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Attributes inherited from Container
Instance Method Summary collapse
- #entity_type_name ⇒ Object
-
#initialize(entity_type:, resolver:, name: nil, url: nil, init_args: nil) ⇒ EntitySet
constructor
A new instance of EntitySet.
- #non_insertable_property_names ⇒ Object
- #resolver_class ⇒ Object
- #supports_collection? ⇒ Boolean
- #supports_count? ⇒ Boolean
- #supports_create? ⇒ Boolean
- #supports_delete? ⇒ Boolean
- #supports_filter_or? ⇒ Boolean
- #supports_individual? ⇒ Boolean
- #supports_search? ⇒ Boolean
- #supports_update? ⇒ Boolean
Constructor Details
#initialize(entity_type:, resolver:, name: nil, url: nil, init_args: nil) ⇒ EntitySet
Returns a new instance of EntitySet.
9 10 11 12 13 14 15 16 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 9 def initialize(entity_type:, resolver:, name: nil, url: nil, init_args: nil) @resolver = resolver.clone name = name&.to_s || @resolver.split('::').last.sub(/Resolver\z/, '') super(name: name) @url = (url&.to_s || @name).clone @entity_type = entity_type @init_args = init_args end |
Instance Attribute Details
#entity_type ⇒ Object (readonly)
Returns the value of attribute entity_type.
7 8 9 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 7 def entity_type @entity_type end |
#init_args ⇒ Object (readonly)
Returns the value of attribute init_args.
7 8 9 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 7 def init_args @init_args end |
#resolver ⇒ Object (readonly)
Returns the value of attribute resolver.
7 8 9 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 7 def resolver @resolver end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
7 8 9 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 7 def url @url end |
Instance Method Details
#entity_type_name ⇒ Object
18 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 18 def entity_type_name = entity_type.name |
#non_insertable_property_names ⇒ Object
61 62 63 64 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 61 def non_insertable_property_names @non_insertable_property_names ||= entity_type.properties.select(&:non_insertable?).map(&:name) end |
#resolver_class ⇒ Object
20 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 20 def resolver_class = Module.const_get(resolver) |
#supports_collection? ⇒ Boolean
31 32 33 34 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 31 def supports_collection? # Check if the resolver class supports read by looking for the collection method resolver_class.method_defined?(:collection) end |
#supports_count? ⇒ Boolean
41 42 43 44 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 41 def supports_count? # Check if the resolver class supports counting via the count method resolver_class.method_defined?(:count) end |
#supports_create? ⇒ Boolean
46 47 48 49 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 46 def supports_create? # Check if the resolver class supports create by looking for the create method resolver_class.method_defined?(:create) end |
#supports_delete? ⇒ Boolean
56 57 58 59 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 56 def supports_delete? # Check if the resolver class supports delete by looking for the delete method resolver_class.method_defined?(:delete) end |
#supports_filter_or? ⇒ Boolean
27 28 29 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 27 def supports_filter_or? resolver_class.method_defined?(:od_filter_or) end |
#supports_individual? ⇒ Boolean
36 37 38 39 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 36 def supports_individual? # Check if the resolver class supports read-by-id via the individual method resolver_class.method_defined?(:individual) end |
#supports_search? ⇒ Boolean
22 23 24 25 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 22 def supports_search? # Check if the resolver class supports search by looking for the od_search method resolver_class.method_defined?(:od_search) end |
#supports_update? ⇒ Boolean
51 52 53 54 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 51 def supports_update? # Check if the resolver class supports update by looking for the update method resolver_class.method_defined?(:update) end |