Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Commit 9ee87cd

Browse files
authored
Merge pull request #1095 from alphagov/update-build-type
Update build_type method to use correct API
2 parents 1e161c3 + 3518ea9 commit 9ee87cd

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

app/services/ckan/v26/link_mapper.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ def build_name(resource)
4040
end
4141

4242
def build_type(resource)
43-
type = resource.get("resource_type")
44-
type == "documentation" ? "Doc" : "Datafile"
43+
type = resource.get("resource-type")
44+
type == "supporting-document" ? "Doc" : "Datafile"
4545
end
4646
end
4747
end

spec/fixtures/files/ckan/v26/package_show_update.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
"position": 1,
113113
"revision_id": "a0372fbf-c991-436c-b0a5-744d499054ee",
114114
"id": "b7e53746-1154-425d-a85d-5bb03eb3f310",
115-
"resource_type": "documentation",
115+
"resource-type": "supporting-document",
116116
"name": "Landing page"
117117
}
118118
],
@@ -196,7 +196,7 @@
196196
"position": 1,
197197
"revision_id": "a0372fbf-c991-436c-b0a5-744d499054ee",
198198
"id": "b7e53746-1154-425d-a85d-5bb03eb3f310",
199-
"resource_type": "documentation",
199+
"resource-type": "supporting-document",
200200
"name": "Landing page"
201201
}
202202
],

spec/services/ckan/v26/link_mapper_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
end
1818

1919
it "correctly distinguishes between datafiles and docs" do
20-
resource = build :ckan_v26_resource, resource_type: "documentation"
20+
resource = build :ckan_v26_resource, "resource-type": "supporting-document"
2121
attributes = subject.call(resource, dataset)
2222
expect(attributes[:type]).to eq "Doc"
2323
end

0 commit comments

Comments
 (0)