sinatra-jsonapi 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.
- data/README.md +3 -3
 - data/lib/sinatra/jsonapi.rb +3 -2
 - data/sinatra-jsonapi.gemspec +1 -2
 - metadata +2 -3
 - data/lib/sinatra/jsonapi/version.rb +0 -5
 
    
        data/README.md
    CHANGED
    
    | 
         @@ -37,14 +37,14 @@ For classy apps: 
     | 
|
| 
       37 
37 
     | 
    
         
             
                  get '/hello' do
         
     | 
| 
       38 
38 
     | 
    
         
             
                    api_response response: 'world!'
         
     | 
| 
       39 
39 
     | 
    
         
             
                  end
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
       41 
41 
     | 
    
         
             
                  # Returns:
         
     | 
| 
       42 
42 
     | 
    
         
             
                  # {"response":"world!"}
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
       44 
44 
     | 
    
         
             
                  get '/break' do
         
     | 
| 
       45 
45 
     | 
    
         
             
                    api_error :your_error_type, 'human readable version of error message'
         
     | 
| 
       46 
46 
     | 
    
         
             
                  end
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
       48 
48 
     | 
    
         
             
                  # Returns:
         
     | 
| 
       49 
49 
     | 
    
         
             
                  # {"error":{"error_type":"your_error_type", "message":"human readable version of your error message"}}
         
     | 
| 
       50 
50 
     | 
    
         
             
                end
         
     | 
    
        data/lib/sinatra/jsonapi.rb
    CHANGED
    
    | 
         @@ -1,9 +1,10 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'sinatra'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'json'
         
     | 
| 
       3 
     | 
    
         
            -
            require './lib/sinatra/jsonapi/version.rb'
         
     | 
| 
       4 
3 
     | 
    
         | 
| 
       5 
4 
     | 
    
         
             
            module Sinatra
         
     | 
| 
       6 
5 
     | 
    
         
             
              module JSONAPI
         
     | 
| 
      
 6 
     | 
    
         
            +
                VERSION = "0.0.3"
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
       7 
8 
     | 
    
         
             
                def self.registered(app)
         
     | 
| 
       8 
9 
     | 
    
         
             
                  app.disable :show_exceptions
         
     | 
| 
       9 
10 
     | 
    
         
             
                  app.disable :raise_errors
         
     | 
| 
         @@ -29,7 +30,7 @@ module Sinatra 
     | 
|
| 
       29 
30 
     | 
    
         | 
| 
       30 
31 
     | 
    
         
             
                    api_error 'not_found', "The requested method was not found: #{request.path}"
         
     | 
| 
       31 
32 
     | 
    
         
             
                  end
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
       33 
34 
     | 
    
         
             
                  app.helpers do
         
     | 
| 
       34 
35 
     | 
    
         
             
                    def api_error(type, message)
         
     | 
| 
       35 
36 
     | 
    
         
             
                      payload = {:error => {:type => type, :message => message}}
         
     | 
    
        data/sinatra-jsonapi.gemspec
    CHANGED
    
    | 
         @@ -1,11 +1,10 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # -*- encoding: utf-8 -*-
         
     | 
| 
       2 
2 
     | 
    
         
             
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
       3 
3 
     | 
    
         
             
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
       4 
     | 
    
         
            -
            require 'sinatra/jsonapi/version'
         
     | 
| 
       5 
4 
     | 
    
         | 
| 
       6 
5 
     | 
    
         
             
            Gem::Specification.new do |gem|
         
     | 
| 
       7 
6 
     | 
    
         
             
              gem.name          = "sinatra-jsonapi"
         
     | 
| 
       8 
     | 
    
         
            -
              gem.version       =  
     | 
| 
      
 7 
     | 
    
         
            +
              gem.version       = '0.0.3'
         
     | 
| 
       9 
8 
     | 
    
         
             
              gem.authors       = ["Kyle Drake"]
         
     | 
| 
       10 
9 
     | 
    
         
             
              gem.email         = ["kyledrake@gmail.com"]
         
     | 
| 
       11 
10 
     | 
    
         
             
              gem.description   = %q{Turns a Sinatra Base class into a JSON api}
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: sinatra-jsonapi
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.3
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2012-11- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2012-11-13 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: json
         
     | 
| 
         @@ -106,7 +106,6 @@ files: 
     | 
|
| 
       106 
106 
     | 
    
         
             
            - README.md
         
     | 
| 
       107 
107 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       108 
108 
     | 
    
         
             
            - lib/sinatra/jsonapi.rb
         
     | 
| 
       109 
     | 
    
         
            -
            - lib/sinatra/jsonapi/version.rb
         
     | 
| 
       110 
109 
     | 
    
         
             
            - sinatra-jsonapi.gemspec
         
     | 
| 
       111 
110 
     | 
    
         
             
            - test/jsonapi_spec.rb
         
     | 
| 
       112 
111 
     | 
    
         
             
            homepage: ''
         
     |