Skip to content
This repository has been archived by the owner on May 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #14 from SmartColumbusOS/smrt-1049
Browse files Browse the repository at this point in the history
Smrt 1049 - Removing `stream` and adding struct version
  • Loading branch information
JarredOlson committed Mar 28, 2019
2 parents 6ebbe16 + dbaa7a2 commit 8f3e0a6
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 13 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const Dataset = {
"dataName": "", // ~r/[a-zA-Z_]+$/
"orgName": "", // ~r/[a-zA-Z_]+$/
"systemName": "", // ${orgName}__${dataName},
"stream": true, //DEPRECATED - See sourceType
"schema": [
{
"name": "",
Expand Down Expand Up @@ -81,7 +80,7 @@ by adding `smart_city_registry` to your list of dependencies in `mix.exs` as fol
```elixir
def deps do
[
{:smart_city_registry, "~> 2.5.0", organization: "smartcolumbus_os"}
{:smart_city_registry, "~> 2.6.0", organization: "smartcolumbus_os"}
]
end
```
Expand Down
3 changes: 1 addition & 2 deletions lib/smart_city/dataset.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ defmodule SmartCity.Dataset do
alias SmartCity.Registry.Subscriber

@type id :: term()

@derive Jason.Encoder
defstruct [:id, :business, :technical]
defstruct version: "0.1", id: nil, business: nil, technical: nil

@conn SmartCity.Registry.Application.db_connection()

Expand Down
3 changes: 1 addition & 2 deletions lib/smart_city/dataset/technical.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ defmodule SmartCity.Dataset.Technical do
defstruct dataName: nil,
orgName: nil,
systemName: nil,
stream: nil,
schema: [],
sourceUrl: nil,
sourceType: "remote",
Expand All @@ -30,7 +29,7 @@ defmodule SmartCity.Dataset.Technical do
|> new()
end

def new(%{dataName: _, orgName: _, systemName: _, stream: _, sourceUrl: _, sourceFormat: _} = msg) do
def new(%{dataName: _, orgName: _, systemName: _, sourceUrl: _, sourceFormat: _} = msg) do
struct(%__MODULE__{}, msg)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/smart_city/organization.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defmodule SmartCity.Organization do
@type reason() :: term()

@derive Jason.Encoder
defstruct [:id, :orgTitle, :orgName, :description, :logoUrl, :homepage, :dn]
defstruct version: "0.1", id: nil, orgTitle: nil, orgName: nil, description: nil, logoUrl: nil, homepage: nil, dn: nil

defmodule NotFound do
defexception [:message]
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule SmartCity.Registry.MixProject do
def project do
[
app: :smart_city_registry,
version: "2.5.0",
version: "2.6.0",
elixir: "~> 1.8",
start_permanent: Mix.env() == :prod,
deps: deps(),
Expand Down
1 change: 0 additions & 1 deletion test/support/fixture_helper.ex
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ defmodule FixtureHelper do
Authorization: "Basic xdasdgdasgdsgd"
},
systemName: "scos",
stream: "IDK",
orgName: "Whatever"
}
},
Expand Down
3 changes: 0 additions & 3 deletions test/unit/smart_city/dataset/technical_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ defmodule SmartCity.Dataset.TechnicalTest do
"dataName" => "dataset",
"orgName" => "org",
"systemName" => "org__dataset",
"stream" => false,
"sourceUrl" => "https://example.com",
"sourceType" => "batch",
"cadence" => 30_000,
Expand All @@ -30,7 +29,6 @@ defmodule SmartCity.Dataset.TechnicalTest do
dataName: "dataset",
orgName: "org",
systemName: "org__dataset",
stream: true,
sourceUrl: "https://example.com",
sourceFormat: "gtfs"
})
Expand Down Expand Up @@ -59,7 +57,6 @@ defmodule SmartCity.Dataset.TechnicalTest do
assert_raise ArgumentError, fn -> Technical.new(tech |> Map.delete("dataName")) end
assert_raise ArgumentError, fn -> Technical.new(tech |> Map.delete("orgName")) end
assert_raise ArgumentError, fn -> Technical.new(tech |> Map.delete("systemName")) end
assert_raise ArgumentError, fn -> Technical.new(tech |> Map.delete("stream")) end
assert_raise ArgumentError, fn -> Technical.new(tech |> Map.delete("sourceUrl")) end
end
end
Expand Down
1 change: 0 additions & 1 deletion test/unit/smart_city/dataset_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ defmodule SmartCity.DatasetTest do
"dataName" => "dataset",
"orgName" => "org",
"systemName" => "org__dataset",
"stream" => false,
"sourceUrl" => "https://example.com",
"sourceFormat" => "gtfs",
"sourceType" => "stream",
Expand Down

0 comments on commit 8f3e0a6

Please sign in to comment.