Skip to content

Commit

Permalink
Merge pull request #6 from PoisotLab/fix-api-change
Browse files Browse the repository at this point in the history
fix API change
  • Loading branch information
tpoisot committed Oct 8, 2019
2 parents 31aa90d + 957d88a commit aac6ba2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/response_format.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ function format_mangal_response(::Type{MangalDataset}, d::Dict{T,Any}) where {T
obj_id = d["id"]
obj_public = d["public"]
obj_name = d["name"]
obj_date = isnothing(d["date"]) ? missing : DateTime(d["date"][1:19])
obj_created = DateTime(d["created_at"][1:19])
obj_updated = DateTime(d["updated_at"][1:19])
obj_reference = isnothing(d["ref_id"]) ? missing : reference(d["ref_id"])
obj_user = d["user_id"]
obj_description = d["description"]

return MangalDataset(obj_id, obj_public, obj_name, obj_date, obj_created,
return MangalDataset(obj_id, obj_public, obj_name, obj_created,
obj_updated, obj_reference, obj_user, obj_description
)
end
Expand Down Expand Up @@ -120,7 +119,7 @@ function format_mangal_response(::Type{MangalAttribute}, d::Dict{T,Any}) where {
obj_id = d["id"]
obj_name = d["name"]
obj_description = d["description"]
obj_unit = inothing(d["unit"]) ? missing : d["unit"]
obj_unit = isnothing(d["unit"] ? missing : d["unit"]

return MangalAttribute(obj_id, obj_name, obj_description, obj_unit)
end
7 changes: 1 addition & 6 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ struct MangalAttribute
id::Int64
name:: AbstractString
description::AbstractString
unit::Union{AbstractString,Missing}
unit::Union{Missing,AbstractString}
end

"""
Expand All @@ -32,10 +32,6 @@ which are *unique*).
`public` (`Bool`): indicates whether the dataset details are available to others
than its owner.
`date` (`DateTime`): date and time at which the dataset was assembled. This can
refer to the sampling time of networks, or to the date at which the dataset was
finalized.
`reference` (`Union{Int64,Nothing}`) (*optional*): a reference to the `id` of
the `MangalReference`, or `nothing` if there is no associated reference for this
dataset.
Expand All @@ -50,7 +46,6 @@ struct MangalDataset
id::Int64
public::Bool
name::AbstractString
date::Union{DateTime,Missing}
created::DateTime
updated::DateTime
reference::Union{MangalReference,Missing}
Expand Down

0 comments on commit aac6ba2

Please sign in to comment.