pluct 0.1.0 → 0.1.1
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/lib/pluct/version.rb +1 -1
- data/lib/pluct.rb +1 -1
- data/spec/integration/resource_spec.rb +8 -0
- data/spec/support/vcr/integration/instance_info.yml +182 -0
- metadata +3 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            !binary "U0hBMQ==":
         | 
| 3 3 | 
             
              metadata.gz: !binary |-
         | 
| 4 | 
            -
                 | 
| 4 | 
            +
                NmU0ZmVmMzA3ZjZjNzI3MzViZTMzNGI0ZjhkNmI4MWMyMTQ5ZjBjNg==
         | 
| 5 5 | 
             
              data.tar.gz: !binary |-
         | 
| 6 | 
            -
                 | 
| 6 | 
            +
                MzdlZmFiMThhY2E1YjY5NTUyNmVmZjU3OTI0ZGM4ODg4MzkwOTY2NQ==
         | 
| 7 7 | 
             
            !binary "U0hBNTEy":
         | 
| 8 8 | 
             
              metadata.gz: !binary |-
         | 
| 9 | 
            -
                 | 
| 10 | 
            -
                 | 
| 11 | 
            -
                 | 
| 9 | 
            +
                MDRlYmU2ZDVjMGRjNjQ5ODMyNzIwZmQ4NjUwYjYxZDA5MWY4MDJhYWM3ZWQ2
         | 
| 10 | 
            +
                MzE5ZWQxMjY1ZGJiZDhkYzAxY2JmOTdiYWQ0ZTA5YzE2ZDM3NThiOTEyYjhl
         | 
| 11 | 
            +
                NTljNTY2NGNmODYwYTJmMGUwZjgyZGQ2ODBhMmViZmY4Y2U5YmY=
         | 
| 12 12 | 
             
              data.tar.gz: !binary |-
         | 
| 13 | 
            -
                 | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 13 | 
            +
                ZGRlMDlkMzgyZGRlYmUyYTVkNjFiZWM5ZTIwMDVmN2FiODVkMjIyNDg5YWM3
         | 
| 14 | 
            +
                MGUwMWIwMGY4NDdhMTViMmY3MDhiZTNiZjdjY2VmZjIwNmJlMGUwZDRkNTNk
         | 
| 15 | 
            +
                NmNkZTIwMGI2YjUwNDE0YzlmNGFmNjkxOWQxMzdkZjk1NTlmYjU=
         | 
    
        data/lib/pluct/version.rb
    CHANGED
    
    
    
        data/lib/pluct.rb
    CHANGED
    
    | @@ -7,7 +7,7 @@ require 'pluct/version' | |
| 7 7 | 
             
            module Pluct
         | 
| 8 8 | 
             
              autoload :Errors,   "pluct/errors"
         | 
| 9 9 | 
             
              autoload :Helpers,  "pluct/helpers"
         | 
| 10 | 
            -
              autoload : | 
| 10 | 
            +
              autoload :JSON,     "pluct/extensions/json"
         | 
| 11 11 | 
             
              autoload :Resource, "pluct/resource"
         | 
| 12 12 | 
             
              autoload :Schema,   "pluct/schema"
         | 
| 13 13 |  | 
| @@ -20,4 +20,12 @@ describe Pluct::Resource, :integration do | |
| 20 20 | 
             
              it 'raises 404 for url not found', :vcr, cassette_name: 'integration/page_not_found' do
         | 
| 21 21 | 
             
                expect {resource.resource({context_name: 'baas', collection_name: 'apps', resource_id: 'invalid'}) }.to raise_error(Pluct::Errors::UrlNotFound)
         | 
| 22 22 | 
             
              end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              it 'reads instance info', :vcr, cassette_name: 'integration/instance_info' do
         | 
| 25 | 
            +
                app = resource.resource({context_name: 'baas', collection_name: 'apps', resource_id: '9b0d0333302a42d3bc8ee00b0afa2121'})
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                expect(app.data).to_not be_empty
         | 
| 28 | 
            +
                expect(app.name).to eq 'New App'
         | 
| 29 | 
            +
                expect(app.description).to eq 'My Awesome App'
         | 
| 30 | 
            +
              end
         | 
| 23 31 | 
             
            end
         | 
| @@ -0,0 +1,182 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            http_interactions:
         | 
| 3 | 
            +
            - request:
         | 
| 4 | 
            +
                method: get
         | 
| 5 | 
            +
                uri: http://localhost:8888/
         | 
| 6 | 
            +
                body:
         | 
| 7 | 
            +
                  encoding: US-ASCII
         | 
| 8 | 
            +
                  string: ''
         | 
| 9 | 
            +
                headers:
         | 
| 10 | 
            +
                  Accept:
         | 
| 11 | 
            +
                  - ! '*/*; q=0.5, application/xml'
         | 
| 12 | 
            +
                  Accept-Encoding:
         | 
| 13 | 
            +
                  - gzip, deflate
         | 
| 14 | 
            +
                  Content-Type:
         | 
| 15 | 
            +
                  - application/json
         | 
| 16 | 
            +
                  User-Agent:
         | 
| 17 | 
            +
                  - Ruby
         | 
| 18 | 
            +
              response:
         | 
| 19 | 
            +
                status:
         | 
| 20 | 
            +
                  code: 200
         | 
| 21 | 
            +
                  message: OK
         | 
| 22 | 
            +
                headers:
         | 
| 23 | 
            +
                  Content-Length:
         | 
| 24 | 
            +
                  - '2'
         | 
| 25 | 
            +
                  Server:
         | 
| 26 | 
            +
                  - TornadoServer/2.4.1
         | 
| 27 | 
            +
                  Etag:
         | 
| 28 | 
            +
                  - ! '"bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f"'
         | 
| 29 | 
            +
                  Link:
         | 
| 30 | 
            +
                  - <http://localhost:8888/root/schemas/root>; rel=describedby
         | 
| 31 | 
            +
                  Cache-Control:
         | 
| 32 | 
            +
                  - max-age=0
         | 
| 33 | 
            +
                  Access-Control-Allow-Origin:
         | 
| 34 | 
            +
                  - ! '*'
         | 
| 35 | 
            +
                  Content-Type:
         | 
| 36 | 
            +
                  - application/json; charset=UTF-8; profile=http://localhost:8888/root/schemas/root
         | 
| 37 | 
            +
                body:
         | 
| 38 | 
            +
                  encoding: US-ASCII
         | 
| 39 | 
            +
                  string: ! '{}'
         | 
| 40 | 
            +
                http_version: 
         | 
| 41 | 
            +
              recorded_at: Thu, 27 Jun 2013 17:58:12 GMT
         | 
| 42 | 
            +
            - request:
         | 
| 43 | 
            +
                method: get
         | 
| 44 | 
            +
                uri: http://localhost:8888/root/schemas/root
         | 
| 45 | 
            +
                body:
         | 
| 46 | 
            +
                  encoding: US-ASCII
         | 
| 47 | 
            +
                  string: ''
         | 
| 48 | 
            +
                headers:
         | 
| 49 | 
            +
                  Accept:
         | 
| 50 | 
            +
                  - ! '*/*; q=0.5, application/xml'
         | 
| 51 | 
            +
                  Accept-Encoding:
         | 
| 52 | 
            +
                  - gzip, deflate
         | 
| 53 | 
            +
                  Content-Type:
         | 
| 54 | 
            +
                  - application/json
         | 
| 55 | 
            +
                  User-Agent:
         | 
| 56 | 
            +
                  - Ruby
         | 
| 57 | 
            +
              response:
         | 
| 58 | 
            +
                status:
         | 
| 59 | 
            +
                  code: 200
         | 
| 60 | 
            +
                  message: OK
         | 
| 61 | 
            +
                headers:
         | 
| 62 | 
            +
                  Content-Length:
         | 
| 63 | 
            +
                  - '336'
         | 
| 64 | 
            +
                  Server:
         | 
| 65 | 
            +
                  - TornadoServer/2.4.1
         | 
| 66 | 
            +
                  Etag:
         | 
| 67 | 
            +
                  - ! '"4ab873749b4a4a304b67e1b1350eadd89e9bb3c0"'
         | 
| 68 | 
            +
                  Cache-Control:
         | 
| 69 | 
            +
                  - max-age=0
         | 
| 70 | 
            +
                  Access-Control-Allow-Origin:
         | 
| 71 | 
            +
                  - ! '*'
         | 
| 72 | 
            +
                  Content-Type:
         | 
| 73 | 
            +
                  - application/json; charset=UTF-8
         | 
| 74 | 
            +
                body:
         | 
| 75 | 
            +
                  encoding: US-ASCII
         | 
| 76 | 
            +
                  string: ! '{"links": [{"href": "http://localhost:8888", "rel": "self"}, {"href":
         | 
| 77 | 
            +
                    "http://localhost:8888/{context_name}", "rel": "context"}, {"href": "http://localhost:8888/{context_name}/{collection_name}",
         | 
| 78 | 
            +
                    "rel": "collection"}, {"href": "http://localhost:8888/{context_name}/{collection_name}/{resource_id}",
         | 
| 79 | 
            +
                    "rel": "resource"}], "title": "Root"}'
         | 
| 80 | 
            +
                http_version: 
         | 
| 81 | 
            +
              recorded_at: Thu, 27 Jun 2013 17:58:12 GMT
         | 
| 82 | 
            +
            - request:
         | 
| 83 | 
            +
                method: get
         | 
| 84 | 
            +
                uri: http://localhost:8888/baas/apps/9b0d0333302a42d3bc8ee00b0afa2121
         | 
| 85 | 
            +
                body:
         | 
| 86 | 
            +
                  encoding: US-ASCII
         | 
| 87 | 
            +
                  string: ''
         | 
| 88 | 
            +
                headers:
         | 
| 89 | 
            +
                  Accept:
         | 
| 90 | 
            +
                  - ! '*/*; q=0.5, application/xml'
         | 
| 91 | 
            +
                  Accept-Encoding:
         | 
| 92 | 
            +
                  - gzip, deflate
         | 
| 93 | 
            +
                  Content-Type:
         | 
| 94 | 
            +
                  - application/json
         | 
| 95 | 
            +
                  User-Agent:
         | 
| 96 | 
            +
                  - Ruby
         | 
| 97 | 
            +
              response:
         | 
| 98 | 
            +
                status:
         | 
| 99 | 
            +
                  code: 200
         | 
| 100 | 
            +
                  message: OK
         | 
| 101 | 
            +
                headers:
         | 
| 102 | 
            +
                  Content-Length:
         | 
| 103 | 
            +
                  - '1037'
         | 
| 104 | 
            +
                  Server:
         | 
| 105 | 
            +
                  - TornadoServer/2.4.1
         | 
| 106 | 
            +
                  Etag:
         | 
| 107 | 
            +
                  - ! '"81dde1fbaab2c8a25df2c25b26ea4b7b64e1cf6b"'
         | 
| 108 | 
            +
                  Link:
         | 
| 109 | 
            +
                  - <http://localhost:8888/baas/schemas/app>; rel=describedby
         | 
| 110 | 
            +
                  Cache-Control:
         | 
| 111 | 
            +
                  - max-age=0
         | 
| 112 | 
            +
                  Access-Control-Allow-Origin:
         | 
| 113 | 
            +
                  - ! '*'
         | 
| 114 | 
            +
                  Content-Type:
         | 
| 115 | 
            +
                  - application/json; charset=UTF-8; profile=http://localhost:8888/baas/schemas/app
         | 
| 116 | 
            +
                body:
         | 
| 117 | 
            +
                  encoding: US-ASCII
         | 
| 118 | 
            +
                  string: ! '{"description": "My Awesome App", "links": [{"href": "http://localhost:8888/baas/schemas/app",
         | 
| 119 | 
            +
                    "rel": "describedBy"}, {"href": "http://localhost:8888/baas/apps/9b0d0333302a42d3bc8ee00b0afa2121",
         | 
| 120 | 
            +
                    "rel": "self"}, {"href": "http://localhost:8888/baas/apps", "rel": "instances"},
         | 
| 121 | 
            +
                    {"href": "http://localhost:8888/baas/apps", "method": "POST", "rel": "create"},
         | 
| 122 | 
            +
                    {"href": "http://localhost:8888/baas/apps/9b0d0333302a42d3bc8ee00b0afa2121",
         | 
| 123 | 
            +
                    "method": "PATCH", "rel": "edit", "schema": {"$ref": "http://localhost:8888/baas/schemas/app"}},
         | 
| 124 | 
            +
                    {"href": "http://localhost:8888/baas/apps/9b0d0333302a42d3bc8ee00b0afa2121",
         | 
| 125 | 
            +
                    "method": "PUT", "rel": "replace", "schema": {"$ref": "http://localhost:8888/baas/schemas/app"}},
         | 
| 126 | 
            +
                    {"href": "http://localhost:8888/baas/apps/9b0d0333302a42d3bc8ee00b0afa2121",
         | 
| 127 | 
            +
                    "method": "DELETE", "rel": "delete", "schema": {"$ref": "http://localhost:8888/baas/schemas/app"}}],
         | 
| 128 | 
            +
                    "resource_id": "9b0d0333302a42d3bc8ee00b0afa2121", "_resource_uri": "http://localhost:8888/baas/apps/9b0d0333302a42d3bc8ee00b0afa2121",
         | 
| 129 | 
            +
                    "name": "New App"}'
         | 
| 130 | 
            +
                http_version: 
         | 
| 131 | 
            +
              recorded_at: Thu, 27 Jun 2013 17:58:12 GMT
         | 
| 132 | 
            +
            - request:
         | 
| 133 | 
            +
                method: get
         | 
| 134 | 
            +
                uri: http://localhost:8888/baas/schemas/app
         | 
| 135 | 
            +
                body:
         | 
| 136 | 
            +
                  encoding: US-ASCII
         | 
| 137 | 
            +
                  string: ''
         | 
| 138 | 
            +
                headers:
         | 
| 139 | 
            +
                  Accept:
         | 
| 140 | 
            +
                  - ! '*/*; q=0.5, application/xml'
         | 
| 141 | 
            +
                  Accept-Encoding:
         | 
| 142 | 
            +
                  - gzip, deflate
         | 
| 143 | 
            +
                  Content-Type:
         | 
| 144 | 
            +
                  - application/json
         | 
| 145 | 
            +
                  User-Agent:
         | 
| 146 | 
            +
                  - Ruby
         | 
| 147 | 
            +
              response:
         | 
| 148 | 
            +
                status:
         | 
| 149 | 
            +
                  code: 200
         | 
| 150 | 
            +
                  message: OK
         | 
| 151 | 
            +
                headers:
         | 
| 152 | 
            +
                  Content-Length:
         | 
| 153 | 
            +
                  - '1097'
         | 
| 154 | 
            +
                  Server:
         | 
| 155 | 
            +
                  - TornadoServer/2.4.1
         | 
| 156 | 
            +
                  Etag:
         | 
| 157 | 
            +
                  - ! '"d1703f3689005faf5c039084fc343acf8548b998"'
         | 
| 158 | 
            +
                  Cache-Control:
         | 
| 159 | 
            +
                  - max-age=0
         | 
| 160 | 
            +
                  Access-Control-Allow-Origin:
         | 
| 161 | 
            +
                  - ! '*'
         | 
| 162 | 
            +
                  Content-Type:
         | 
| 163 | 
            +
                  - application/json; charset=UTF-8
         | 
| 164 | 
            +
                body:
         | 
| 165 | 
            +
                  encoding: US-ASCII
         | 
| 166 | 
            +
                  string: ! '{"links": [{"href": "http://localhost:8888/baas/schemas/app", "rel":
         | 
| 167 | 
            +
                    "describedBy"}, {"href": "http://localhost:8888/baas/apps/{resource_id}",
         | 
| 168 | 
            +
                    "rel": "self"}, {"href": "http://localhost:8888/baas/apps", "rel": "instances"},
         | 
| 169 | 
            +
                    {"href": "http://localhost:8888/baas/apps", "method": "POST", "rel": "create"},
         | 
| 170 | 
            +
                    {"href": "http://localhost:8888/baas/apps/{resource_id}", "method": "PATCH",
         | 
| 171 | 
            +
                    "rel": "edit", "schema": {"$ref": "http://localhost:8888/baas/schemas/app"}},
         | 
| 172 | 
            +
                    {"href": "http://localhost:8888/baas/apps/{resource_id}", "method": "PUT",
         | 
| 173 | 
            +
                    "rel": "replace", "schema": {"$ref": "http://localhost:8888/baas/schemas/app"}},
         | 
| 174 | 
            +
                    {"href": "http://localhost:8888/baas/apps/{resource_id}", "method": "DELETE",
         | 
| 175 | 
            +
                    "rel": "delete", "schema": {"$ref": "http://localhost:8888/baas/schemas/app"}}],
         | 
| 176 | 
            +
                    "title": "App", "resource_id": "app", "collection_name": "apps", "required":
         | 
| 177 | 
            +
                    ["name", "description", "username"], "properties": {"username": {"type": "string",
         | 
| 178 | 
            +
                    "title": "Nome do Usu\u00e1rio"}, "name": {"type": "string", "title": "Nome"},
         | 
| 179 | 
            +
                    "description": {"minLength": 10, "type": "string", "title": "Descri\u00e7\u00e3o"}}}'
         | 
| 180 | 
            +
                http_version: 
         | 
| 181 | 
            +
              recorded_at: Thu, 27 Jun 2013 17:58:12 GMT
         | 
| 182 | 
            +
            recorded_with: VCR 2.5.0
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: pluct
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Alberto Leal
         | 
| @@ -183,6 +183,7 @@ files: | |
| 183 183 | 
             
            - spec/support/vcr.rb
         | 
| 184 184 | 
             
            - spec/support/vcr/integration/creates_new_app.yml
         | 
| 185 185 | 
             
            - spec/support/vcr/integration/expands_uri.yml
         | 
| 186 | 
            +
            - spec/support/vcr/integration/instance_info.yml
         | 
| 186 187 | 
             
            - spec/support/vcr/integration/page_not_found.yml
         | 
| 187 188 | 
             
            homepage: http://github.com/globocom/pluct-ruby
         | 
| 188 189 | 
             
            licenses:
         | 
| @@ -220,5 +221,6 @@ test_files: | |
| 220 221 | 
             
            - spec/support/vcr.rb
         | 
| 221 222 | 
             
            - spec/support/vcr/integration/creates_new_app.yml
         | 
| 222 223 | 
             
            - spec/support/vcr/integration/expands_uri.yml
         | 
| 224 | 
            +
            - spec/support/vcr/integration/instance_info.yml
         | 
| 223 225 | 
             
            - spec/support/vcr/integration/page_not_found.yml
         | 
| 224 226 | 
             
            has_rdoc: 
         |