Most of the main classes that users interact with when using the service (i.e. Service, EntitySet, Entity, etc.) are extremely verbose when printed on the console, which makes exploring a service using irb somewhat difficult.
We should implement #to_s for these classes in order to show a more condensed summary with only the necessary information.
Notes
The main issue here are properties which refer to the XML metadata, those end up printing the entire tree and should therefore be omitted from #to_s.
Service
All we need is here is the name and service_url attributes, like so:
For the properties field, use the result of self.to_hash. For navigation_properties, use self.navigation_properties.keys.
Property
Should only display the name, value, and options without the :service key. value should print the return value of the value getter, NOT the internal value of the @value instance variable.
Background
Most of the main classes that users interact with when using the service (i.e.
Service
,EntitySet
,Entity
, etc.) are extremely verbose when printed on the console, which makes exploring a service usingirb
somewhat difficult.We should implement
#to_s
for these classes in order to show a more condensed summary with only the necessary information.Notes
The main issue here are properties which refer to the XML metadata, those end up printing the entire tree and should therefore be omitted from
#to_s
.Service
All we need is here is the
name
andservice_url
attributes, like so:Schema
Should only print the attributes on the corresponding XML tag, i.e.
namespace
andalias
(we don't use the latter at the moment).EntitySet
Entity
This one is going to require the most work. Currently produces a HUGE amount of noise.
For the
properties
field, use the result ofself.to_hash
. Fornavigation_properties
, useself.navigation_properties.keys
.Property
Should only display the name, value, and options without the
:service
key.value
should print the return value of thevalue
getter, NOT the internal value of the@value
instance variable.NavigationProperty
EnumType
ComplexType