Sha256: 5a0be27a854ef7b0d115e8db1e08c425cea94cfdd50499930c0aeaf0fdec71c2

Contents?: true

Size: 1.98 KB

Versions: 7

Compression:

Stored size: 1.98 KB

Contents

require 'json'

module Spinach
  module Fixtures
    def root_response
      '{
          "_links": {
              "self": { "href": "/" },
              "posts": { "href": "/posts" },
              "search": { "href": "/search{?q}", "templated": true },
              "tagged": { "href": "/search{?tags*}", "templated": true },
              "api:authors": { "href": "/authors" },
              "next": { "href": "/page2" }
          }
      }'
    end

    def posts_response
      '{
          "_links": {
            "self": { "href": "/posts" },
            "last_post": {"href": "/posts/1"}
          },
          "total_posts": "2",
          "_embedded": {
            "posts": [
              {
                "title": "My first blog post",
                "body":  "Lorem ipsum dolor sit amet",
                "_links": {
                  "self": { "href": "/posts/1" }
                }
              },
              {
                "title": "My second blog post",
                "body":  "Lorem ipsum dolor sit amet",
                "_links": {
                  "self": { "href": "/posts/2" }
                }
              }
            ]
          }
      }'
    end

    def post_response
      '{
          "_links": {
            "self": { "href": "/posts/1" }
          },
          "title": "My first blog post",
          "body":  "Lorem ipsum dolor sit amet",
          "_embedded": {
            "comments": [
              {
                "title": "Some comment"
              }
            ]
          }
      }'
    end

    def page2_response
      '{
          "_links": {
              "self": { "href": "/page2" },
              "posts": { "href": "/posts_of_page2" },
              "next": { "href": "/page3" }
          }
      }'
    end

    def page3_response
      '{
          "_links": {
              "self": { "href": "/page3" },
              "posts": { "href": "/posts_of_page3" },
              "api:authors": { "href": "/authors" }
          }
      }'
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hyperclient-0.9.3 features/support/fixtures.rb
hyperclient-0.9.1 features/support/fixtures.rb
hyperclient-0.9.0 features/support/fixtures.rb
hyperclient-0.8.6 features/support/fixtures.rb
hyperclient-0.8.5 features/support/fixtures.rb
hyperclient-0.8.4 features/support/fixtures.rb
hyperclient-0.8.3 features/support/fixtures.rb