restful_objects 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
 - data/README.md +3 -2
 - data/bin/restful_server.rb +0 -0
 - data/lib/restful_objects/action_description.rb +96 -82
 - data/lib/restful_objects/action_list.rb +17 -17
 - data/lib/restful_objects/collection_description.rb +47 -47
 - data/lib/restful_objects/collection_list.rb +17 -17
 - data/lib/restful_objects/domain_model.rb +83 -79
 - data/lib/restful_objects/http_response.rb +11 -11
 - data/lib/restful_objects/link_generator.rb +104 -104
 - data/lib/restful_objects/object.rb +20 -20
 - data/lib/restful_objects/object_actions.rb +134 -134
 - data/lib/restful_objects/object_base.rb +10 -0
 - data/lib/restful_objects/object_collections.rb +84 -84
 - data/lib/restful_objects/object_list.rb +16 -16
 - data/lib/restful_objects/object_macros.rb +35 -35
 - data/lib/restful_objects/object_properties.rb +78 -78
 - data/lib/restful_objects/parameter_description.rb +60 -60
 - data/lib/restful_objects/parameter_description_list.rb +15 -15
 - data/lib/restful_objects/property_description.rb +68 -68
 - data/lib/restful_objects/property_list.rb +17 -17
 - data/lib/restful_objects/service.rb +21 -21
 - data/lib/restful_objects/service_list.rb +55 -55
 - data/lib/restful_objects/type.rb +110 -110
 - data/lib/restful_objects/type_list.rb +30 -30
 - data/lib/restful_objects/user.rb +30 -30
 - data/lib/restful_objects/version.rb +1 -1
 - data/spec/integration/domain-types_actions_spec.rb +43 -43
 - data/spec/integration/domain-types_collections_spec.rb +45 -45
 - data/spec/integration/domain-types_properties_spec.rb +41 -41
 - data/spec/integration/server-root_spec.rb +98 -98
 - data/spec/spec_helper.rb +52 -52
 - data/spec/unit/object_actions_spec.rb +380 -380
 - data/spec/unit/object_collections_spec.rb +190 -190
 - data/spec/unit/object_properties_spec.rb +215 -206
 - data/spec/unit/object_spec.rb +228 -228
 - data/spec/unit/service_spec.rb +125 -125
 - data/spec/unit/type_list_spec.rb +37 -37
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            !binary "U0hBMQ==":
         
     | 
| 
       3 
3 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       4 
     | 
    
         
            -
                 
     | 
| 
      
 4 
     | 
    
         
            +
                ZTk4ZmFkNzBlZDBlZmIwNzkxMjVmYzY5Nzg1NGQ5N2IyMGIzODRiYg==
         
     | 
| 
       5 
5 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       6 
     | 
    
         
            -
                 
     | 
| 
      
 6 
     | 
    
         
            +
                OGU3NDBlZDE3OWRhZmZmNThhN2YxM2Q4YTk5Mjk3NmRmMDI3Mzk1Yw==
         
     | 
| 
       7 
7 
     | 
    
         
             
            SHA512:
         
     | 
| 
       8 
8 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
       10 
     | 
    
         
            -
                 
     | 
| 
       11 
     | 
    
         
            -
                 
     | 
| 
      
 9 
     | 
    
         
            +
                NDRmZDgzY2NkNzFiYzk1MjUyNTkyMTVkYzcyNzZmZjcyN2UwNDI1NWIwZjJk
         
     | 
| 
      
 10 
     | 
    
         
            +
                ZjYzYjU2ZDFkZDNiMWRlZGMwYmM0Y2VlMzg0ZWFjMDcxMjQyNDhjMDU3MDVj
         
     | 
| 
      
 11 
     | 
    
         
            +
                MDA5MGM2NmRiN2Q2MDNjYTgxYjc2MzhhZTU5ZDIxYzNlMDYzN2I=
         
     | 
| 
       12 
12 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
       15 
     | 
    
         
            -
                 
     | 
| 
      
 13 
     | 
    
         
            +
                MGM4N2Y2MGU1MDMwNDk4MDJlMjE2MzZhODQ5Y2MxMDRjY2E2YmE0ZTYwYzQ4
         
     | 
| 
      
 14 
     | 
    
         
            +
                M2JiODdhMDRkNzFjYjgwNTQxN2Y0ODJmNTlhOTZjNTFjYTJlNWZmMmE2NjQ0
         
     | 
| 
      
 15 
     | 
    
         
            +
                NGJkZThmMTNkNzRmNGI4Y2U5YzcyYjExYWMwYmE3NTlkNjdmM2Q=
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -44,7 +44,8 @@ class Graph 
     | 
|
| 
       44 
44 
     | 
    
         
             
              end
         
     | 
| 
       45 
45 
     | 
    
         
             
            end
         
     | 
| 
       46 
46 
     | 
    
         
             
            ```
         
     | 
| 
       47 
     | 
    
         
            -
             
         
     | 
| 
      
 47 
     | 
    
         
            +
            You can check this example and more [here](https://github.com/vizcay/RestfulObjectsRubyExamples).
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
       48 
49 
     | 
    
         
             
            ### How to install it?
         
     | 
| 
       49 
50 
     | 
    
         
             
            Run
         
     | 
| 
       50 
51 
     | 
    
         | 
| 
         @@ -64,7 +65,7 @@ to your's project Gemfile and 'bundle install' it. 
     | 
|
| 
       64 
65 
     | 
    
         
             
            The source quality is at alpha state, and it was created mostly as a proof of concept. Still is has plenty of specs and a big percentage of the specification implemented, the grey areas are mostly related to errors and validations. It has been developed with MRI and hasn't been tested on other Ruby implementations.
         
     | 
| 
       65 
66 
     | 
    
         | 
| 
       66 
67 
     | 
    
         
             
            ### Dependencies
         
     | 
| 
       67 
     | 
    
         
            -
            - [Ruby 1.9.3 or higher](https://www.ruby-lang.org 
     | 
| 
      
 68 
     | 
    
         
            +
            - [Ruby 1.9.3 or higher](https://www.ruby-lang.org/)
         
     | 
| 
       68 
69 
     | 
    
         
             
            - [Sinatra](http://www.sinatrarb.com/)
         
     | 
| 
       69 
70 
     | 
    
         
             
            - [RSpec](http://rspec.info/)
         
     | 
| 
       70 
71 
     | 
    
         
             
            - [json_expressions](https://github.com/chancancode/json_expressions) for json testing.
         
     | 
    
        data/bin/restful_server.rb
    CHANGED
    
    | 
         
            File without changes
         
     | 
| 
         @@ -1,82 +1,96 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            module RestfulObjects
         
     | 
| 
       2 
     | 
    
         
            -
              class ActionDescription
         
     | 
| 
       3 
     | 
    
         
            -
                include LinkGenerator
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
                attr_reader :id, :kind_result_type, :result_type, :parameters
         
     | 
| 
       6 
     | 
    
         
            -
                attr_accessor :friendly_name, :description, :member_order, :disabled_reason
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
                def initialize(id,  
     | 
| 
       9 
     | 
    
         
            -
                  @id 
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                   
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                   
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                   
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
                   
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                     
     | 
| 
       47 
     | 
    
         
            -
                       
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
                  representation 
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
                   
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
                 
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
                end
         
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            module RestfulObjects
         
     | 
| 
      
 2 
     | 
    
         
            +
              class ActionDescription
         
     | 
| 
      
 3 
     | 
    
         
            +
                include LinkGenerator
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                attr_reader :id, :kind_result_type, :result_type, :parameters
         
     | 
| 
      
 6 
     | 
    
         
            +
                attr_accessor :friendly_name, :description, :member_order, :disabled_reason
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                def initialize(id, domain_type, options)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  @id              = id
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @domain_type     = domain_type
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @friendly_name   = options[:friendly_name]   || id
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @description     = options[:description]     || id
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @member_order    = options[:member_order]    || 0
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @disabled_reason = options[:disabled_reason] || ''
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  case options[:return_type]
         
     | 
| 
      
 17 
     | 
    
         
            +
                    when NilClass
         
     | 
| 
      
 18 
     | 
    
         
            +
                      @result_type      = :void
         
     | 
| 
      
 19 
     | 
    
         
            +
                      @kind_result_type = :void
         
     | 
| 
      
 20 
     | 
    
         
            +
                    when Symbol
         
     | 
| 
      
 21 
     | 
    
         
            +
                      if options[:return_type] == :void
         
     | 
| 
      
 22 
     | 
    
         
            +
                        @result_type      = :void
         
     | 
| 
      
 23 
     | 
    
         
            +
                        @kind_result_type = :void
         
     | 
| 
      
 24 
     | 
    
         
            +
                      else
         
     | 
| 
      
 25 
     | 
    
         
            +
                        raise "result type for scalar '#{options[:return_type]}' unssuported" unless [:string, :int, :bool, :decimal, :date, :blob].include?(options[:return_type])
         
     | 
| 
      
 26 
     | 
    
         
            +
                        @result_type      = options[:return_type]
         
     | 
| 
      
 27 
     | 
    
         
            +
                        @kind_result_type = :scalar
         
     | 
| 
      
 28 
     | 
    
         
            +
                      end
         
     | 
| 
      
 29 
     | 
    
         
            +
                    when Hash
         
     | 
| 
      
 30 
     | 
    
         
            +
                      options[:return_type]
         
     | 
| 
      
 31 
     | 
    
         
            +
                      if options[:return_type][:object]
         
     | 
| 
      
 32 
     | 
    
         
            +
                        @result_type      = options[:return_type][:object]
         
     | 
| 
      
 33 
     | 
    
         
            +
                        @kind_result_type = :object
         
     | 
| 
      
 34 
     | 
    
         
            +
                      elsif options[:return_type][:proto_object]
         
     | 
| 
      
 35 
     | 
    
         
            +
                        @result_type      = options[:return_type][:proto_object]
         
     | 
| 
      
 36 
     | 
    
         
            +
                        @kind_result_type = :proto_object
         
     | 
| 
      
 37 
     | 
    
         
            +
                      elsif options[:return_type][:list]
         
     | 
| 
      
 38 
     | 
    
         
            +
                        @result_type      = options[:return_type][:list]
         
     | 
| 
      
 39 
     | 
    
         
            +
                        @kind_result_type = :list
         
     | 
| 
      
 40 
     | 
    
         
            +
                      else
         
     | 
| 
      
 41 
     | 
    
         
            +
                        raise 'invalid return_type: object, proto_object or list key expected'
         
     | 
| 
      
 42 
     | 
    
         
            +
                      end
         
     | 
| 
      
 43 
     | 
    
         
            +
                      unless @result_type.is_a?(Class) or @result_type.is_a?(String)
         
     | 
| 
      
 44 
     | 
    
         
            +
                        raise 'return_type object, proto_object or list value should be a class or a string' 
         
     | 
| 
      
 45 
     | 
    
         
            +
                      end
         
     | 
| 
      
 46 
     | 
    
         
            +
                    else
         
     | 
| 
      
 47 
     | 
    
         
            +
                      raise 'invalid return_type: symbol or hash expected'
         
     | 
| 
      
 48 
     | 
    
         
            +
                  end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                  @parameters = ParameterDescriptionList.new
         
     | 
| 
      
 51 
     | 
    
         
            +
                  options[:parameters].each { |name, definition| @parameters.add(name, definition) } if options[:parameters]
         
     | 
| 
      
 52 
     | 
    
         
            +
                end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                def get_representation
         
     | 
| 
      
 55 
     | 
    
         
            +
                  representation = {
         
     | 
| 
      
 56 
     | 
    
         
            +
                    'id' => @id,
         
     | 
| 
      
 57 
     | 
    
         
            +
                    'hasParams' => has_params,
         
     | 
| 
      
 58 
     | 
    
         
            +
                    'memberOrder' => @member_order,
         
     | 
| 
      
 59 
     | 
    
         
            +
                    'parameters' => parameters_list,
         
     | 
| 
      
 60 
     | 
    
         
            +
                    'links' => [
         
     | 
| 
      
 61 
     | 
    
         
            +
                      link_to(:self, "/domain-types/#{@domain_type}/actions/#{@id}", :action_description),
         
     | 
| 
      
 62 
     | 
    
         
            +
                      link_to(:up, "/domain-types/#{@domain_type}", :domain_type),
         
     | 
| 
      
 63 
     | 
    
         
            +
                      link_to(:return_type, "/domain-types/#{result_type}", :domain_type)
         
     | 
| 
      
 64 
     | 
    
         
            +
                    ],
         
     | 
| 
      
 65 
     | 
    
         
            +
                    'extensions' => {}
         
     | 
| 
      
 66 
     | 
    
         
            +
                  }
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                  representation['friendlyName'] = friendly_name if friendly_name
         
     | 
| 
      
 69 
     | 
    
         
            +
                  representation['description'] = description if description
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                  representation.to_json
         
     | 
| 
      
 72 
     | 
    
         
            +
                end
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                def metadata
         
     | 
| 
      
 75 
     | 
    
         
            +
                  result = { 'friendlyName' => friendly_name,
         
     | 
| 
      
 76 
     | 
    
         
            +
                             'description' => description,
         
     | 
| 
      
 77 
     | 
    
         
            +
                             'returnType' => result_type,
         
     | 
| 
      
 78 
     | 
    
         
            +
                             'hasParams' => has_params,
         
     | 
| 
      
 79 
     | 
    
         
            +
                             'memberOrder' => member_order }
         
     | 
| 
      
 80 
     | 
    
         
            +
                end
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
                def has_params
         
     | 
| 
      
 83 
     | 
    
         
            +
                  not @parameters.empty?
         
     | 
| 
      
 84 
     | 
    
         
            +
                end
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
                def parameters_list
         
     | 
| 
      
 87 
     | 
    
         
            +
                  result = {}
         
     | 
| 
      
 88 
     | 
    
         
            +
                  parameters.each do |name, parameter|
         
     | 
| 
      
 89 
     | 
    
         
            +
                    result[name] = {
         
     | 
| 
      
 90 
     | 
    
         
            +
                      'extension' => parameter.metadata
         
     | 
| 
      
 91 
     | 
    
         
            +
                    }
         
     | 
| 
      
 92 
     | 
    
         
            +
                  end
         
     | 
| 
      
 93 
     | 
    
         
            +
                  result
         
     | 
| 
      
 94 
     | 
    
         
            +
                end
         
     | 
| 
      
 95 
     | 
    
         
            +
              end
         
     | 
| 
      
 96 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,17 +1,17 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            module RestfulObjects
         
     | 
| 
       2 
     | 
    
         
            -
              class ActionList
         
     | 
| 
       3 
     | 
    
         
            -
                extend Forwardable
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
                def initialize(domain_type)
         
     | 
| 
       6 
     | 
    
         
            -
                  @actions = Hash.new
         
     | 
| 
       7 
     | 
    
         
            -
                  @domain_type = domain_type
         
     | 
| 
       8 
     | 
    
         
            -
                end
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
                def add(id,  
     | 
| 
       11 
     | 
    
         
            -
                  options[:member_order] ||= count + 1
         
     | 
| 
       12 
     | 
    
         
            -
                  @actions[id] = ActionDescription.new(id,  
     | 
| 
       13 
     | 
    
         
            -
                end
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                def_delegators :@actions, :[], :each, :include?, :count, :empty?
         
     | 
| 
       16 
     | 
    
         
            -
              end
         
     | 
| 
       17 
     | 
    
         
            -
            end
         
     | 
| 
      
 1 
     | 
    
         
            +
            module RestfulObjects
         
     | 
| 
      
 2 
     | 
    
         
            +
              class ActionList
         
     | 
| 
      
 3 
     | 
    
         
            +
                extend Forwardable
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                def initialize(domain_type)
         
     | 
| 
      
 6 
     | 
    
         
            +
                  @actions = Hash.new
         
     | 
| 
      
 7 
     | 
    
         
            +
                  @domain_type = domain_type
         
     | 
| 
      
 8 
     | 
    
         
            +
                end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                def add(id, options = {})
         
     | 
| 
      
 11 
     | 
    
         
            +
                  options[:member_order] ||= count + 1
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @actions[id] = ActionDescription.new(id, @domain_type, options)
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                def_delegators :@actions, :[], :each, :include?, :count, :empty?
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,47 +1,47 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            module RestfulObjects
         
     | 
| 
       2 
     | 
    
         
            -
              class CollectionDescription
         
     | 
| 
       3 
     | 
    
         
            -
                include LinkGenerator
         
     | 
| 
       4 
     | 
    
         
            -
                attr_reader :id, :type, :read_only
         
     | 
| 
       5 
     | 
    
         
            -
                attr_accessor :friendly_name, :description, :plural_form, :member_order, :disabled_reason
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
                def initialize(id, type, domain_type, options = {})
         
     | 
| 
       8 
     | 
    
         
            -
                  @id = id
         
     | 
| 
       9 
     | 
    
         
            -
                  @type = type
         
     | 
| 
       10 
     | 
    
         
            -
                  @domain_type = domain_type
         
     | 
| 
       11 
     | 
    
         
            -
                  @read_only = options[:read_only].nil? ? false : options[:read_only]
         
     | 
| 
       12 
     | 
    
         
            -
                  @disabled_reason = options[:disabled_reason] || 'read only collection' if read_only
         
     | 
| 
       13 
     | 
    
         
            -
                  @friendly_name = options[:friendly_name] || id
         
     | 
| 
       14 
     | 
    
         
            -
                  @description = options[:description] || id
         
     | 
| 
       15 
     | 
    
         
            -
                  @plural_form = options[:plural_form]
         
     | 
| 
       16 
     | 
    
         
            -
                  @member_order = options[:member_order]
         
     | 
| 
       17 
     | 
    
         
            -
                end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                def get_representation
         
     | 
| 
       20 
     | 
    
         
            -
                  representation = {
         
     | 
| 
       21 
     | 
    
         
            -
                    'id' => id,
         
     | 
| 
       22 
     | 
    
         
            -
                    'memberOrder' => member_order,
         
     | 
| 
       23 
     | 
    
         
            -
                    'links' => [
         
     | 
| 
       24 
     | 
    
         
            -
                      link_to(:self, "/domain-types/#{@domain_type}/collections/#{@id}", :collection_description),
         
     | 
| 
       25 
     | 
    
         
            -
                      link_to(:up, "/domain-types/#{@domain_type}", :domain_type),
         
     | 
| 
       26 
     | 
    
         
            -
                      link_to(:return_type, "/domain-types/list", :domain_type),
         
     | 
| 
       27 
     | 
    
         
            -
                      link_to(:element_type, "/domain-types/#{@type}", :domain_type)
         
     | 
| 
       28 
     | 
    
         
            -
                    ],
         
     | 
| 
       29 
     | 
    
         
            -
                    'extensions' => metadata
         
     | 
| 
       30 
     | 
    
         
            -
                  }
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                  representation['friendlyName'] = friendly_name if friendly_name
         
     | 
| 
       33 
     | 
    
         
            -
                  representation['description'] = description if description
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
                  representation.to_json
         
     | 
| 
       36 
     | 
    
         
            -
                end
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
                def metadata
         
     | 
| 
       39 
     | 
    
         
            -
                  { 'friendlyName' => friendly_name,
         
     | 
| 
       40 
     | 
    
         
            -
                    'description' => description,
         
     | 
| 
       41 
     | 
    
         
            -
                    'returnType' => 'list',
         
     | 
| 
       42 
     | 
    
         
            -
                    'elementType' => type,
         
     | 
| 
       43 
     | 
    
         
            -
                    'memberOrder' => member_order,
         
     | 
| 
       44 
     | 
    
         
            -
                    'pluralForm' => plural_form }
         
     | 
| 
       45 
     | 
    
         
            -
                end
         
     | 
| 
       46 
     | 
    
         
            -
              end
         
     | 
| 
       47 
     | 
    
         
            -
            end
         
     | 
| 
      
 1 
     | 
    
         
            +
            module RestfulObjects
         
     | 
| 
      
 2 
     | 
    
         
            +
              class CollectionDescription
         
     | 
| 
      
 3 
     | 
    
         
            +
                include LinkGenerator
         
     | 
| 
      
 4 
     | 
    
         
            +
                attr_reader :id, :type, :read_only
         
     | 
| 
      
 5 
     | 
    
         
            +
                attr_accessor :friendly_name, :description, :plural_form, :member_order, :disabled_reason
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(id, type, domain_type, options = {})
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @id = id
         
     | 
| 
      
 9 
     | 
    
         
            +
                  @type = type
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @domain_type = domain_type
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @read_only = options[:read_only].nil? ? false : options[:read_only]
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @disabled_reason = options[:disabled_reason] || 'read only collection' if read_only
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @friendly_name = options[:friendly_name] || id
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @description = options[:description] || id
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @plural_form = options[:plural_form]
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @member_order = options[:member_order]
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                def get_representation
         
     | 
| 
      
 20 
     | 
    
         
            +
                  representation = {
         
     | 
| 
      
 21 
     | 
    
         
            +
                    'id' => id,
         
     | 
| 
      
 22 
     | 
    
         
            +
                    'memberOrder' => member_order,
         
     | 
| 
      
 23 
     | 
    
         
            +
                    'links' => [
         
     | 
| 
      
 24 
     | 
    
         
            +
                      link_to(:self, "/domain-types/#{@domain_type}/collections/#{@id}", :collection_description),
         
     | 
| 
      
 25 
     | 
    
         
            +
                      link_to(:up, "/domain-types/#{@domain_type}", :domain_type),
         
     | 
| 
      
 26 
     | 
    
         
            +
                      link_to(:return_type, "/domain-types/list", :domain_type),
         
     | 
| 
      
 27 
     | 
    
         
            +
                      link_to(:element_type, "/domain-types/#{@type}", :domain_type)
         
     | 
| 
      
 28 
     | 
    
         
            +
                    ],
         
     | 
| 
      
 29 
     | 
    
         
            +
                    'extensions' => metadata
         
     | 
| 
      
 30 
     | 
    
         
            +
                  }
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                  representation['friendlyName'] = friendly_name if friendly_name
         
     | 
| 
      
 33 
     | 
    
         
            +
                  representation['description'] = description if description
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                  representation.to_json
         
     | 
| 
      
 36 
     | 
    
         
            +
                end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                def metadata
         
     | 
| 
      
 39 
     | 
    
         
            +
                  { 'friendlyName' => friendly_name,
         
     | 
| 
      
 40 
     | 
    
         
            +
                    'description' => description,
         
     | 
| 
      
 41 
     | 
    
         
            +
                    'returnType' => 'list',
         
     | 
| 
      
 42 
     | 
    
         
            +
                    'elementType' => type,
         
     | 
| 
      
 43 
     | 
    
         
            +
                    'memberOrder' => member_order,
         
     | 
| 
      
 44 
     | 
    
         
            +
                    'pluralForm' => plural_form }
         
     | 
| 
      
 45 
     | 
    
         
            +
                end
         
     | 
| 
      
 46 
     | 
    
         
            +
              end
         
     | 
| 
      
 47 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,17 +1,17 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            module RestfulObjects
         
     | 
| 
       2 
     | 
    
         
            -
              class CollectionList
         
     | 
| 
       3 
     | 
    
         
            -
                extend Forwardable
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
                def initialize(domain_type)
         
     | 
| 
       6 
     | 
    
         
            -
                  @domain_type = domain_type
         
     | 
| 
       7 
     | 
    
         
            -
                  @collections = Hash.new
         
     | 
| 
       8 
     | 
    
         
            -
                end
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
                def add(name, type, options = {})
         
     | 
| 
       11 
     | 
    
         
            -
                  options[:member_order] ||= count + 1
         
     | 
| 
       12 
     | 
    
         
            -
                  @collections[name] = CollectionDescription.new(name, type, @domain_type, options)
         
     | 
| 
       13 
     | 
    
         
            -
                end
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                def_delegators :@collections, :[], :each, :each_key, :each_value, :include?, :count, :empty?, :clear
         
     | 
| 
       16 
     | 
    
         
            -
              end
         
     | 
| 
       17 
     | 
    
         
            -
            end
         
     | 
| 
      
 1 
     | 
    
         
            +
            module RestfulObjects
         
     | 
| 
      
 2 
     | 
    
         
            +
              class CollectionList
         
     | 
| 
      
 3 
     | 
    
         
            +
                extend Forwardable
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                def initialize(domain_type)
         
     | 
| 
      
 6 
     | 
    
         
            +
                  @domain_type = domain_type
         
     | 
| 
      
 7 
     | 
    
         
            +
                  @collections = Hash.new
         
     | 
| 
      
 8 
     | 
    
         
            +
                end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                def add(name, type, options = {})
         
     | 
| 
      
 11 
     | 
    
         
            +
                  options[:member_order] ||= count + 1
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @collections[name] = CollectionDescription.new(name, type, @domain_type, options)
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                def_delegators :@collections, :[], :each, :each_key, :each_value, :include?, :count, :empty?, :clear
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,79 +1,83 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            module RestfulObjects
         
     | 
| 
       2 
     | 
    
         
            -
              class DomainModel
         
     | 
| 
       3 
     | 
    
         
            -
                include LinkGenerator
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
                attr_accessor :base_url, :compatible_mode
         
     | 
| 
       6 
     | 
    
         
            -
                attr_reader :metadata_schema, :version, :user, :types, :services, :objects
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
                def self.current
         
     | 
| 
       9 
     | 
    
         
            -
                  @current ||= DomainModel.new
         
     | 
| 
       10 
     | 
    
         
            -
                end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
                def self.current=(value)
         
     | 
| 
       13 
     | 
    
         
            -
                  @current = value
         
     | 
| 
       14 
     | 
    
         
            -
                end
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                def initialize
         
     | 
| 
       17 
     | 
    
         
            -
                  @base_url = 'http://localhost'
         
     | 
| 
       18 
     | 
    
         
            -
                  @metadata_schema = :selectable
         
     | 
| 
       19 
     | 
    
         
            -
                  @compatible_mode = false
         
     | 
| 
       20 
     | 
    
         
            -
                  @user = User.new(@base_url, 'anonymous')
         
     | 
| 
       21 
     | 
    
         
            -
                  @types = TypeList.new
         
     | 
| 
       22 
     | 
    
         
            -
                  @services = ServiceList.new(@base_url)
         
     | 
| 
       23 
     | 
    
         
            -
                  @objects = ObjectList.new(@base_url)
         
     | 
| 
       24 
     | 
    
         
            -
                end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                def get_homepage
         
     | 
| 
       27 
     | 
    
         
            -
                  { 'links' => [
         
     | 
| 
       28 
     | 
    
         
            -
                      link_to(:self, '/', :homepage),
         
     | 
| 
       29 
     | 
    
         
            -
                      link_to(:user, '/user', :user),
         
     | 
| 
       30 
     | 
    
         
            -
                      link_to(:services, '/services', :list),
         
     | 
| 
       31 
     | 
    
         
            -
                      link_to(:version, '/version', :version),
         
     | 
| 
       32 
     | 
    
         
            -
                      link_to(:domain_types, '/domain-types', :type_list)
         
     | 
| 
       33 
     | 
    
         
            -
                    ],
         
     | 
| 
       34 
     | 
    
         
            -
                   'extensions' => {}
         
     | 
| 
       35 
     | 
    
         
            -
                  }.to_json
         
     | 
| 
       36 
     | 
    
         
            -
                end
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
                def get_version
         
     | 
| 
       39 
     | 
    
         
            -
                  { 'links' => [
         
     | 
| 
       40 
     | 
    
         
            -
                      link_to(:self, '/version', :version),
         
     | 
| 
       41 
     | 
    
         
            -
                      link_to(:up, '/', :homepage),
         
     | 
| 
       42 
     | 
    
         
            -
                    ],
         
     | 
| 
       43 
     | 
    
         
            -
                    'specVersion' => '1.0',
         
     | 
| 
       44 
     | 
    
         
            -
                    'optionalCapabilities' => {
         
     | 
| 
       45 
     | 
    
         
            -
                      'blobsClobs' => true,
         
     | 
| 
       46 
     | 
    
         
            -
                      'deleteObjects' => true,
         
     | 
| 
       47 
     | 
    
         
            -
                      'domainModel' => metadata_schema.to_s,
         
     | 
| 
       48 
     | 
    
         
            -
                      'protoPersistentObjects' => true,
         
     | 
| 
       49 
     | 
    
         
            -
                      'validateOnly' => false
         
     | 
| 
       50 
     | 
    
         
            -
                    },
         
     | 
| 
       51 
     | 
    
         
            -
                    'extensions' => {}
         
     | 
| 
       52 
     | 
    
         
            -
                  }.to_json
         
     | 
| 
       53 
     | 
    
         
            -
                end
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
                def get_user
         
     | 
| 
       56 
     | 
    
         
            -
                  @user.get_as_json
         
     | 
| 
       57 
     | 
    
         
            -
                end
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
                def get_services
         
     | 
| 
       60 
     | 
    
         
            -
                  services.get_list
         
     | 
| 
       61 
     | 
    
         
            -
                end
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                def metadata_schema=(value)
         
     | 
| 
       64 
     | 
    
         
            -
                  if not [:simple, :formal, :selectable].include?(value)
         
     | 
| 
       65 
     | 
    
         
            -
                    raise "invalid metadata schema, choose :simple, :formal or :selectable"
         
     | 
| 
       66 
     | 
    
         
            -
                  end
         
     | 
| 
       67 
     | 
    
         
            -
                  @metadata_schema = value
         
     | 
| 
       68 
     | 
    
         
            -
                end
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
                def reset
         
     | 
| 
       71 
     | 
    
         
            -
                  @base_url = 'http://localhost'
         
     | 
| 
       72 
     | 
    
         
            -
                  @user = nil
         
     | 
| 
       73 
     | 
    
         
            -
                  @types.clear
         
     | 
| 
       74 
     | 
    
         
            -
                  @services.clear
         
     | 
| 
       75 
     | 
    
         
            -
                  @objects.clear
         
     | 
| 
       76 
     | 
    
         
            -
                end
         
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            module RestfulObjects
         
     | 
| 
      
 2 
     | 
    
         
            +
              class DomainModel
         
     | 
| 
      
 3 
     | 
    
         
            +
                include LinkGenerator
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                attr_accessor :base_url, :compatible_mode
         
     | 
| 
      
 6 
     | 
    
         
            +
                attr_reader :metadata_schema, :version, :user, :types, :services, :objects
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                def self.current
         
     | 
| 
      
 9 
     | 
    
         
            +
                  @current ||= DomainModel.new
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                def self.current=(value)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @current = value
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                def initialize
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @base_url = 'http://localhost'
         
     | 
| 
      
 18 
     | 
    
         
            +
                  @metadata_schema = :selectable
         
     | 
| 
      
 19 
     | 
    
         
            +
                  @compatible_mode = false
         
     | 
| 
      
 20 
     | 
    
         
            +
                  @user = User.new(@base_url, 'anonymous')
         
     | 
| 
      
 21 
     | 
    
         
            +
                  @types = TypeList.new
         
     | 
| 
      
 22 
     | 
    
         
            +
                  @services = ServiceList.new(@base_url)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @objects = ObjectList.new(@base_url)
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                def get_homepage
         
     | 
| 
      
 27 
     | 
    
         
            +
                  { 'links' => [
         
     | 
| 
      
 28 
     | 
    
         
            +
                      link_to(:self, '/', :homepage),
         
     | 
| 
      
 29 
     | 
    
         
            +
                      link_to(:user, '/user', :user),
         
     | 
| 
      
 30 
     | 
    
         
            +
                      link_to(:services, '/services', :list),
         
     | 
| 
      
 31 
     | 
    
         
            +
                      link_to(:version, '/version', :version),
         
     | 
| 
      
 32 
     | 
    
         
            +
                      link_to(:domain_types, '/domain-types', :type_list)
         
     | 
| 
      
 33 
     | 
    
         
            +
                    ],
         
     | 
| 
      
 34 
     | 
    
         
            +
                   'extensions' => {}
         
     | 
| 
      
 35 
     | 
    
         
            +
                  }.to_json
         
     | 
| 
      
 36 
     | 
    
         
            +
                end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                def get_version
         
     | 
| 
      
 39 
     | 
    
         
            +
                  { 'links' => [
         
     | 
| 
      
 40 
     | 
    
         
            +
                      link_to(:self, '/version', :version),
         
     | 
| 
      
 41 
     | 
    
         
            +
                      link_to(:up, '/', :homepage),
         
     | 
| 
      
 42 
     | 
    
         
            +
                    ],
         
     | 
| 
      
 43 
     | 
    
         
            +
                    'specVersion' => '1.0',
         
     | 
| 
      
 44 
     | 
    
         
            +
                    'optionalCapabilities' => {
         
     | 
| 
      
 45 
     | 
    
         
            +
                      'blobsClobs' => true,
         
     | 
| 
      
 46 
     | 
    
         
            +
                      'deleteObjects' => true,
         
     | 
| 
      
 47 
     | 
    
         
            +
                      'domainModel' => metadata_schema.to_s,
         
     | 
| 
      
 48 
     | 
    
         
            +
                      'protoPersistentObjects' => true,
         
     | 
| 
      
 49 
     | 
    
         
            +
                      'validateOnly' => false
         
     | 
| 
      
 50 
     | 
    
         
            +
                    },
         
     | 
| 
      
 51 
     | 
    
         
            +
                    'extensions' => {}
         
     | 
| 
      
 52 
     | 
    
         
            +
                  }.to_json
         
     | 
| 
      
 53 
     | 
    
         
            +
                end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                def get_user
         
     | 
| 
      
 56 
     | 
    
         
            +
                  @user.get_as_json
         
     | 
| 
      
 57 
     | 
    
         
            +
                end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
                def get_services
         
     | 
| 
      
 60 
     | 
    
         
            +
                  services.get_list
         
     | 
| 
      
 61 
     | 
    
         
            +
                end
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
                def metadata_schema=(value)
         
     | 
| 
      
 64 
     | 
    
         
            +
                  if not [:simple, :formal, :selectable].include?(value)
         
     | 
| 
      
 65 
     | 
    
         
            +
                    raise "invalid metadata schema, choose :simple, :formal or :selectable"
         
     | 
| 
      
 66 
     | 
    
         
            +
                  end
         
     | 
| 
      
 67 
     | 
    
         
            +
                  @metadata_schema = value
         
     | 
| 
      
 68 
     | 
    
         
            +
                end
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
                def reset
         
     | 
| 
      
 71 
     | 
    
         
            +
                  @base_url = 'http://localhost'
         
     | 
| 
      
 72 
     | 
    
         
            +
                  @user = nil
         
     | 
| 
      
 73 
     | 
    
         
            +
                  @types.clear
         
     | 
| 
      
 74 
     | 
    
         
            +
                  @services.clear
         
     | 
| 
      
 75 
     | 
    
         
            +
                  @objects.clear
         
     | 
| 
      
 76 
     | 
    
         
            +
                end
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                def reset_objects
         
     | 
| 
      
 79 
     | 
    
         
            +
                  @objects.clear
         
     | 
| 
      
 80 
     | 
    
         
            +
                end
         
     | 
| 
      
 81 
     | 
    
         
            +
              end
         
     | 
| 
      
 82 
     | 
    
         
            +
            end
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     |