Class: OdataDuty::SchemaBuilder::EntitySet
- Defined in:
- lib/odata_duty/schema_builder/entity_set.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#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, description: 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, description: nil) ⇒ EntitySet
Returns a new instance of EntitySet.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 9 def initialize(entity_type:, resolver:, name: nil, url: nil, init_args: nil, description: 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 @description = Property.resolve_description(@name, description) end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
7 8 9 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 7 def description @description end |
#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
20 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 20 def entity_type_name = entity_type.name |
#non_insertable_property_names ⇒ Object
63 64 65 66 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 63 def non_insertable_property_names @non_insertable_property_names ||= entity_type.properties.select(&:non_insertable?).map(&:name) end |
#resolver_class ⇒ Object
22 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 22 def resolver_class = Module.const_get(resolver) |
#supports_collection? ⇒ Boolean
33 34 35 36 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 33 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
43 44 45 46 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 43 def supports_count? # Check if the resolver class supports counting via the count method resolver_class.method_defined?(:count) end |
#supports_create? ⇒ Boolean
48 49 50 51 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 48 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
58 59 60 61 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 58 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
29 30 31 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 29 def supports_filter_or? resolver_class.method_defined?(:od_filter_or) end |
#supports_individual? ⇒ Boolean
38 39 40 41 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 38 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
24 25 26 27 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 24 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
53 54 55 56 |
# File 'lib/odata_duty/schema_builder/entity_set.rb', line 53 def supports_update? # Check if the resolver class supports update by looking for the update method resolver_class.method_defined?(:update) end |