Class: RestfulObjects::DomainModel
- Inherits:
-
Object
- Object
- RestfulObjects::DomainModel
- Includes:
- LinkGenerator
- Defined in:
- lib/restful_objects/domain_model.rb
Instance Attribute Summary collapse
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#compatible_mode ⇒ Object
Returns the value of attribute compatible_mode.
-
#metadata_schema ⇒ Object
Returns the value of attribute metadata_schema.
-
#objects ⇒ Object
readonly
Returns the value of attribute objects.
-
#services ⇒ Object
readonly
Returns the value of attribute services.
-
#types ⇒ Object
readonly
Returns the value of attribute types.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
- #get_homepage ⇒ Object
- #get_services ⇒ Object
- #get_user ⇒ Object
- #get_version ⇒ Object
-
#initialize ⇒ DomainModel
constructor
A new instance of DomainModel.
- #reset ⇒ Object
- #reset_objects ⇒ Object
Methods included from LinkGenerator
#generate_rel, #generate_repr_type, #link_to, #underscore_to_hyphen_string
Constructor Details
#initialize ⇒ DomainModel
Returns a new instance of DomainModel.
16 17 18 19 20 21 22 23 24 |
# File 'lib/restful_objects/domain_model.rb', line 16 def initialize @base_url = 'http://localhost' = :selectable @compatible_mode = false @user = User.new(@base_url, 'anonymous') @types = TypeList.new @services = ServiceList.new(@base_url) @objects = ObjectList.new(@base_url) end |
Instance Attribute Details
#base_url ⇒ Object
Returns the value of attribute base_url.
5 6 7 |
# File 'lib/restful_objects/domain_model.rb', line 5 def base_url @base_url end |
#compatible_mode ⇒ Object
Returns the value of attribute compatible_mode.
5 6 7 |
# File 'lib/restful_objects/domain_model.rb', line 5 def compatible_mode @compatible_mode end |
#metadata_schema ⇒ Object
Returns the value of attribute metadata_schema.
6 7 8 |
# File 'lib/restful_objects/domain_model.rb', line 6 def end |
#objects ⇒ Object (readonly)
Returns the value of attribute objects.
6 7 8 |
# File 'lib/restful_objects/domain_model.rb', line 6 def objects @objects end |
#services ⇒ Object (readonly)
Returns the value of attribute services.
6 7 8 |
# File 'lib/restful_objects/domain_model.rb', line 6 def services @services end |
#types ⇒ Object (readonly)
Returns the value of attribute types.
6 7 8 |
# File 'lib/restful_objects/domain_model.rb', line 6 def types @types end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
6 7 8 |
# File 'lib/restful_objects/domain_model.rb', line 6 def user @user end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
6 7 8 |
# File 'lib/restful_objects/domain_model.rb', line 6 def version @version end |
Class Method Details
.current ⇒ Object
8 9 10 |
# File 'lib/restful_objects/domain_model.rb', line 8 def self.current @current ||= DomainModel.new end |
.current=(value) ⇒ Object
12 13 14 |
# File 'lib/restful_objects/domain_model.rb', line 12 def self.current=(value) @current = value end |
Instance Method Details
#get_homepage ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/restful_objects/domain_model.rb', line 26 def get_homepage { 'links' => [ link_to(:self, '/', :homepage), link_to(:user, '/user', :user), link_to(:services, '/services', :list), link_to(:version, '/version', :version), link_to(:domain_types, '/domain-types', :type_list) ], 'extensions' => {} }.to_json end |
#get_services ⇒ Object
59 60 61 |
# File 'lib/restful_objects/domain_model.rb', line 59 def get_services services.get_list end |
#get_user ⇒ Object
55 56 57 |
# File 'lib/restful_objects/domain_model.rb', line 55 def get_user @user.get_as_json end |
#get_version ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/restful_objects/domain_model.rb', line 38 def get_version { 'links' => [ link_to(:self, '/version', :version), link_to(:up, '/', :homepage), ], 'specVersion' => '1.0', 'optionalCapabilities' => { 'blobsClobs' => true, 'deleteObjects' => true, 'domainModel' => .to_s, 'protoPersistentObjects' => true, 'validateOnly' => false }, 'extensions' => {} }.to_json end |
#reset ⇒ Object
70 71 72 73 74 75 76 |
# File 'lib/restful_objects/domain_model.rb', line 70 def reset @base_url = 'http://localhost' @user = nil @types.clear @services.clear @objects.clear end |
#reset_objects ⇒ Object
78 79 80 |
# File 'lib/restful_objects/domain_model.rb', line 78 def reset_objects @objects.clear end |