Skip to content

bbc/mozart-fetcher

Repository files navigation

Fetcher

The service provides a single /collect endpoint which expects a JSON payload in the format:

{
    "components": [{
        "id": "stream-icons",
        "endpoint": "https://s3-eu-west-1.amazonaws.com/shared-application-buckets-public-1pmfwo80l61it/load-tests/static_envelopes/25082016/small-1.0.4.json",
        "must_succeed": true
    }]
}

The component endpoint will return:

{
  "head": [],
  "bodyInline": "<DIV id=\"site-container\" role=\"main\">",
  "bodyLast": []
}

Fetcher returns a JSON collection of components in this format:

{
    "components": [{
        "Index": "<index>",
        "id": "<component_id>",
        "Status": "<component_status>",
        "envelope": {
            "head": [],
            "bodyInline": "",
            "bodyLast": []
        }
    }]
}

Installation

If available in Hex, the package can be installed by adding mozart_fetcher to your list of dependencies in mix.exs:

def deps do
  [
    {:mozart_fetcher, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/mozart_fetcher.

Run locally

You'll need to set the environment variable DEV_CERT_PEM to the path to your BBC developer certificate.

# get dependencies
mix deps.get

# compile project
mix compile

# run the project
mix run --no-halt

# run the project interactive mode
iex -S mix

Local endpoints

curl localhost:8080/status

curl -X POST --data '{"components":[{"id":"stream-icons","endpoint":"https://s3-eu-west-1.amazonaws.com/shared-application-buckets-public-1pmfwo80l61it/load-tests/static_envelopes/25082016/small-1.0.4.json","must_succeed":true}]}' localhost:8080/collect

curl -X POST --data @test/fixtures/payload_multiple_small.json localhost:8080/collect

Run tests

mix test

Metrics

To list the metrics available for this app, run: mix list_metrics

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published