wadl_generator 0.1.1 → 0.1.2
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.
- data/.gitignore +0 -1
- data/Gemfile.lock +16 -0
- data/README.markdown +8 -0
- data/lib/wadl/generator.rb +30 -24
- data/wadl_generator.gemspec +2 -0
- metadata +21 -7
    
        data/.gitignore
    CHANGED
    
    
    
        data/Gemfile.lock
    ADDED
    
    
    
        data/README.markdown
    CHANGED
    
    | @@ -40,9 +40,11 @@ | |
| 40 40 | 
             
                      :base => "#{request.url.gsub('/description.wadl', '')}",
         | 
| 41 41 | 
             
                      :resources => {
         | 
| 42 42 | 
             
                        'posts' => {
         | 
| 43 | 
            +
                          :index => true,
         | 
| 43 44 | 
             
                          :index_formats => {
         | 
| 44 45 | 
             
                            :json => 'application/json',
         | 
| 45 46 | 
             
                          },
         | 
| 47 | 
            +
                          :show => true,
         | 
| 46 48 | 
             
                          :show_formats => {
         | 
| 47 49 | 
             
                            :json => 'application/json',
         | 
| 48 50 | 
             
                            :html => 'application/html',
         | 
| @@ -50,6 +52,12 @@ | |
| 50 52 | 
             
                          },
         | 
| 51 53 | 
             
                          :example_id => 28,
         | 
| 52 54 | 
             
                        },
         | 
| 55 | 
            +
                        'categories' => {
         | 
| 56 | 
            +
                          :index => true,
         | 
| 57 | 
            +
                          :index_formats => {
         | 
| 58 | 
            +
                            :json => 'application/json',
         | 
| 59 | 
            +
                          },
         | 
| 60 | 
            +
                        }
         | 
| 53 61 | 
             
                      }
         | 
| 54 62 | 
             
                    }
         | 
| 55 63 | 
             
                  end
         | 
    
        data/lib/wadl/generator.rb
    CHANGED
    
    | @@ -1,6 +1,8 @@ | |
| 1 | 
            +
            require 'builder'
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            module WADL
         | 
| 2 4 | 
             
              class Generator
         | 
| 3 | 
            -
                VERSION = '0.1. | 
| 5 | 
            +
                VERSION = '0.1.2'
         | 
| 4 6 |  | 
| 5 7 | 
             
                attr_reader :description, :options, :wadl
         | 
| 6 8 |  | 
| @@ -33,38 +35,42 @@ module WADL | |
| 33 35 | 
             
                    xml.resources(:base => description[:base]) do
         | 
| 34 36 | 
             
                      description[:resources].each do |name, config|
         | 
| 35 37 | 
             
                        # index
         | 
| 36 | 
            -
                         | 
| 37 | 
            -
                          xml. | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
                               | 
| 38 | 
            +
                        if config[:index] && config[:index_formats].present?
         | 
| 39 | 
            +
                          xml.resource(:path => "#{name.pluralize.underscore}.{format}") do
         | 
| 40 | 
            +
                            xml.param(:name => 'format', :type => 'xsd:string', :style => 'template',
         | 
| 41 | 
            +
                                :required => true, :default => config[:index_formats].keys.first) do
         | 
| 42 | 
            +
                              config[:index_formats].each do |format, mime_type|
         | 
| 43 | 
            +
                                xml.option(:value => format, :mediaType => mime_type)
         | 
| 44 | 
            +
                              end
         | 
| 41 45 | 
             
                            end
         | 
| 42 | 
            -
                          end
         | 
| 43 46 |  | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 47 | 
            +
                            xml.method('id' => name.pluralize.underscore, 'name' => 'GET') do
         | 
| 48 | 
            +
                              if options[:apigee]
         | 
| 49 | 
            +
                                xml.tag!('apigee:tags') { xml.tag!('apigee:tag', name.singularize.camelcase, :primary => true) }
         | 
| 50 | 
            +
                                xml.tag!('apigee:authentication', :required => false)
         | 
| 51 | 
            +
                                xml.tag!('apigee:example', :url => "/#{name.pluralize.underscore}.#{config[:index_formats].keys.first}")
         | 
| 52 | 
            +
                              end
         | 
| 49 53 | 
             
                            end
         | 
| 50 54 | 
             
                          end
         | 
| 51 55 | 
             
                        end
         | 
| 52 56 |  | 
| 53 57 | 
             
                        # show
         | 
| 54 | 
            -
                         | 
| 55 | 
            -
                          xml. | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            -
                               | 
| 58 | 
            +
                        if config[:show] && config[:show_formats].present?
         | 
| 59 | 
            +
                          xml.resource(:path => "#{name.pluralize.underscore}/{id}.{format}") do
         | 
| 60 | 
            +
                            xml.param(:name => 'format', :type => 'xsd:string', :style => 'template',
         | 
| 61 | 
            +
                                :required => true, :default => config[:show_formats].keys.first) do
         | 
| 62 | 
            +
                              config[:show_formats].each do |format, mime_type|
         | 
| 63 | 
            +
                                xml.option(:value => format, :mediaType => mime_type)
         | 
| 64 | 
            +
                              end
         | 
| 59 65 | 
             
                            end
         | 
| 60 | 
            -
             | 
| 61 | 
            -
                          xml.param(:name => 'id', :type => 'xsd:string', :style => 'query', :required => true)
         | 
| 66 | 
            +
                            xml.param(:name => 'id', :type => 'xsd:string', :style => 'query', :required => true)
         | 
| 62 67 |  | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            +
                            xml.method('id' => name.singularize.underscore, 'name' => 'GET') do
         | 
| 69 | 
            +
                              if options[:apigee]
         | 
| 70 | 
            +
                                xml.tag!('apigee:tags') { xml.tag!('apigee:tag', name.singularize.camelcase, :primary => true) }
         | 
| 71 | 
            +
                                xml.tag!('apigee:authentication', :required => false)
         | 
| 72 | 
            +
                                xml.tag!('apigee:example', :url => "/#{name.pluralize.underscore}/#{config[:example_id]}.#{config[:show_formats].keys.first}")
         | 
| 73 | 
            +
                              end
         | 
| 68 74 | 
             
                            end
         | 
| 69 75 | 
             
                          end
         | 
| 70 76 | 
             
                        end
         | 
    
        data/wadl_generator.gemspec
    CHANGED
    
    | @@ -14,6 +14,8 @@ Gem::Specification.new do |s| | |
| 14 14 |  | 
| 15 15 | 
             
              s.rubyforge_project = "wadl_generator"
         | 
| 16 16 |  | 
| 17 | 
            +
              s.add_dependency 'builder'
         | 
| 18 | 
            +
             | 
| 17 19 | 
             
              s.files         = `git ls-files`.split("\n")
         | 
| 18 20 | 
             
              s.test_files    = `git ls-files -- {test,spec,features}/*`.split("\n")
         | 
| 19 21 | 
             
              s.executables   = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
         | 
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: wadl_generator
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 31
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 0
         | 
| 8 8 | 
             
              - 1
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 0.1. | 
| 9 | 
            +
              - 2
         | 
| 10 | 
            +
              version: 0.1.2
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - Thomas Maurer
         | 
| @@ -15,10 +15,23 @@ autorequire: | |
| 15 15 | 
             
            bindir: bin
         | 
| 16 16 | 
             
            cert_chain: []
         | 
| 17 17 |  | 
| 18 | 
            -
            date: 2011-03- | 
| 18 | 
            +
            date: 2011-03-14 00:00:00 +01:00
         | 
| 19 19 | 
             
            default_executable: 
         | 
| 20 | 
            -
            dependencies:  | 
| 21 | 
            -
             | 
| 20 | 
            +
            dependencies: 
         | 
| 21 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 22 | 
            +
              name: builder
         | 
| 23 | 
            +
              prerelease: false
         | 
| 24 | 
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 25 | 
            +
                none: false
         | 
| 26 | 
            +
                requirements: 
         | 
| 27 | 
            +
                - - ">="
         | 
| 28 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 29 | 
            +
                    hash: 3
         | 
| 30 | 
            +
                    segments: 
         | 
| 31 | 
            +
                    - 0
         | 
| 32 | 
            +
                    version: "0"
         | 
| 33 | 
            +
              type: :runtime
         | 
| 34 | 
            +
              version_requirements: *id001
         | 
| 22 35 | 
             
            description: Simple WADL Generator targeted on REST APIs with optional Apigee Flavour
         | 
| 23 36 | 
             
            email: 
         | 
| 24 37 | 
             
            - tma@freshbit.ch
         | 
| @@ -31,6 +44,7 @@ extra_rdoc_files: [] | |
| 31 44 | 
             
            files: 
         | 
| 32 45 | 
             
            - .gitignore
         | 
| 33 46 | 
             
            - Gemfile
         | 
| 47 | 
            +
            - Gemfile.lock
         | 
| 34 48 | 
             
            - README.markdown
         | 
| 35 49 | 
             
            - Rakefile
         | 
| 36 50 | 
             
            - lib/wadl/generator.rb
         | 
| @@ -66,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 66 80 | 
             
            requirements: []
         | 
| 67 81 |  | 
| 68 82 | 
             
            rubyforge_project: wadl_generator
         | 
| 69 | 
            -
            rubygems_version: 1. | 
| 83 | 
            +
            rubygems_version: 1.6.2
         | 
| 70 84 | 
             
            signing_key: 
         | 
| 71 85 | 
             
            specification_version: 3
         | 
| 72 86 | 
             
            summary: Simple WADL Generator targeted on REST APIs with optional Apigee Flavour
         |