Logo: Relish

  1. Sign in

Project: Hobby-hunter

Stores API

In order to find the store I want

As the HH iPhone App

I want to consume JSON store listings + details

Scenarios
Listing
Given
the following stores:
name Oakland Models JB's Models
address Barnstones West Street, Clipsham, Rutland 53 Great Northern Gardens, Bourne, Lincs
postcode LE15 7SJ PE10 9EH
telephone 01780410620 7885613279
website www.oaklandmodels.co.uk www.jbmodelshop.co.uk
email [email protected] [email protected]
photo
logo
synopsis Pretty big text Pretty big text redux
colour_scheme green blue
lat 52.735046 52.788351
lon -0.566348 -0.367493
id 4d659e657f5bfd20d6000003 4d659e657f5bfd20d6000004
And
their opening times:
store Oakland Models JB's Models
monday 9am - 6pm CLOSED
tuesday 9am - 6pm CLOSED
wednesday CLOSED 8am - 6pm
thursday 9am - 6pm 10am - 8pm
friday 9am - 6pm 9am - 6pm
saturday 8am - 7pm 9am - 7pm
sunday 8am - 7pm 9am - 7pm
And
their store types:
store name id
Oakland Models Plastic Kits 4d659e687f5bfd20d6000005
Oakland Models Model Rail 4d659e687f5bfd20d6000006
Oakland Models Accessories 4d659e687f5bfd20d6000007
JB's Models Plastic Kits 4d659e687f5bfd20d6000005
JB's Models Slot Cars 4d659e687f5bfd20d6000008
JB's Models Radio Controlled 4d659e687f5bfd20d6000009
JB's Models Accessories 4d659e687f5bfd20d600000a
And
their services:
store name id
Oakland Models Model Store 4d659f137f5bfd20d600000b
Oakland Models Mail Order 4d659f137f5bfd20d600000c
Oakland Models Cards Accepted 4d659f137f5bfd20d600000d
Oakland Models Selected Club Membership Discount 4d659f137f5bfd20d600000e
JB's Models Model Store 4d659f137f5bfd20d600000b
JB's Models Mail Order 4d65a4227f5bfd224d000003
JB's Models eCommerce 4d659f137f5bfd20d6000004
JB's Models Selected Club Membership Discount 4d65a4227f5bfd224d000002
When
I send a GET request to "/api/stores.json"
Then
I should see JSON:
[
		{
			"id":"4d659e657f5bfd20d6000003",
			"name":"Oakland Models",
			"address":"Barnstones West Street, Clipsham, Rutland",
			"postcode":"LE15 7SJ",
			"telephone":"01780410620",
			"website":"www.oaklandmodels.co.uk",
			"email":"[email protected]",
			"photo": "",
			"logo": "",
    "synopsis": "Pretty big text",
    "store_types":[
				{
        "id":"4d659e687f5bfd20d6000005",
        "name":"Plastic Kits"
      },
				{
        "id":"4d659e687f5bfd20d6000006",
        "name":"Model Rail"
      },
				{
        "id":"4d659e687f5bfd20d6000007",
        "name":"Accessories"
      }
    ],
    "services":[
				{
        "id":"4d659f137f5bfd20d600000b",
        "name":"Model Store"
      },
				{
        "id":"4d659f137f5bfd20d600000c",					
        "name":"Mail Order"
      },
				{
        "id":"4d659f137f5bfd20d600000d",
        "name":"Cards Accepted"
      },
				{
        "id":"4d659f137f5bfd20d600000e",
        "name":"Selected Club Membership Discount"
      }
    ],
			"colour_scheme":"green",
			"monday":"9am - 6pm",
			"tuesday":"9am - 6pm",
			"wednesday":"CLOSED",
			"thursday":"9am - 6pm",
			"friday":"9am - 6pm",
			"saturday":"8am - 7pm",
			"sunday":"8am - 7pm",
			"lat":52.735046,
			"lon":-0.566348
		},
		{
			"id":"4d659e657f5bfd20d6000004",
			"name":"JB's Models",
			"address":"53 Great Northern Gardens, Bourne, Lincs",
			"postcode":"PE10 9EH",
			"telephone":"7885613279",
			"website":"www.jbmodelshop.co.uk",
			"email":"[email protected]",
			"photo": "",
			"logo": "",
    "synopsis": "Pretty big text redux",
    "store_types":[
  			{
        "id":"4d659e687f5bfd20d6000005",
        "name":"Plastic Kits"
      },
  			{
        "id":"4d659e687f5bfd20d6000008",
        "name":"Slot Cars"
      },
  			{
        "id":"4d659e687f5bfd20d6000009",
        "name":"Radio Controlled"
      },
  			{
        "id":"4d659e687f5bfd20d600000a",
        "name":"Accessories"
      }
      ],
    "services":[
  			{
        "id":"4d659f137f5bfd20d600000b",
        "name":"Model Store"
      },
  			{
        "id":"4d65a4227f5bfd224d000003",
        "name":"Mail Order"
      },
  			{
        "id":"4d65a4227f5bfd224d000004",
        "name":"eCommerce"
      },
  			{
        "id":"4d65a4227f5bfd224d000005",
        "name":"Selected Club Membership Discount"
      }
      ],
			"colour_scheme":"blue",
			"monday":"CLOSED",
			"tuesday":"CLOSED",
			"wednesday":"8am - 6pm",
			"thursday":"10am - 8pm",
			"friday":"9am - 6pm",
			"saturday":"9am - 7pm",
			"sunday":"9am - 7pm",
			"lat":52.788351,
			"lon":-0.367493
		}
	]
Given
the following stores:
name Oakland Models JB's Models
address Barnstones West Street, Clipsham, Rutland 53 Great Northern Gardens, Bourne, Lincs
When
I send a GET request to "/api/stores.json?search=Oakland+Models"
Then
I should see JSON with "Oakland Models"
And
I should not see JSON with "JB's Models"
When
I send a GET request to "/api/stores.json?search=Something+not+in+the+db"
Then
I should not see JSON with "Oakland Models"
And
I should not see JSON with "JB's Models"
When
I send a GET request to "/api/stores.json?search=JB"
Then
I should see JSON with "JB's Models"
And
I should not see JSON with "Oakland Models"
When
I send a GET request to "/api/stores.json?search=jb"
Then
I should see JSON with "JB's Models"
And
I should not see JSON with "Oakland Models"

Last published over 4 years ago by oliverbarnes.