Skip to content

Commit

Permalink
Merge pull request #75 from WebApiContrib/dev
Browse files Browse the repository at this point in the history
Release 0.6.2
  • Loading branch information
glennblock committed Jul 7, 2014
2 parents e65a648 + 87ca69d commit 9df3381
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 125 deletions.
42 changes: 9 additions & 33 deletions src/WebApiContrib.CollectionJson/Collection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,46 +19,22 @@ public Collection()
}

[DataMember(Name="version")]
public string Version
{
get { return GetValue<string>("Version"); }
set { SetValue("Version", value); }
}

public string Version { get; set; }

[DataMember(Name = "href")]
public Uri Href
{
get { return GetValue<Uri>("Href"); }
set { SetValue("Href", value); }
}
public Uri Href { get; set; }

[DataMember(Name = "links")]
public IList<Link> Links
{
get { return GetValue<IList<Link>>("Links"); }
private set { SetValue("Links", value); }
}

public IList<Link> Links { get; private set; }

[DataMember(Name = "items")]
public IList<Item> Items
{
get { return GetValue<IList<Item>>("Items"); }
private set { SetValue("Items", value); }
}
public IList<Item> Items { get; private set; }

[DataMember(Name = "queries")]
public IList<Query> Queries
{
get { return GetValue<IList<Query>>("Queries"); }
private set { SetValue("Queries", value); }
}

public IList<Query> Queries { get; private set; }

[DataMember(Name = "template")]
public Template Template
{
get { return GetValue<Template>("Template"); }
set { SetValue("Template", value); }
}
public Template Template { get; private set; }
}

}
19 changes: 4 additions & 15 deletions src/WebApiContrib.CollectionJson/Data.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,13 @@ namespace WebApiContrib.CollectionJson
public class Data : ExtensibleObject
{
[DataMember(Name = "name")]
public string Name
{
get { return GetValue<string>("Name"); }
set { SetValue("Name", value); }
}
public string Name { get; set; }

[DataMember(Name = "value")]
public string Value
{
get { return GetValue<string>("Value"); }
set { SetValue("Value", value); }
}
public string Value { get; set; }

[DataMember(Name = "prompt")]
public string Prompt
{
get { return GetValue<string>("Prompt"); }
set { SetValue("Prompt", value); }
}
public string Prompt { get; set; }

}
}
6 changes: 3 additions & 3 deletions src/WebApiContrib.CollectionJson/ExtensibleObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public ExtensibleObject()
Members = new Dictionary<string, object>(StringComparer.CurrentCultureIgnoreCase);
}

protected IDictionary<string, object> Members { get; private set; }

protected IDictionary<string, object> Members { get; private set; }
public override bool TryGetMember(GetMemberBinder binder, out object result)
{
var name = binder.Name;
Expand Down Expand Up @@ -58,7 +58,7 @@ public void SetValue(string key, object value)
{
Members[key] = value;
}

public dynamic Extensions()
{
return this;
Expand Down
30 changes: 5 additions & 25 deletions src/WebApiContrib.CollectionJson/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,19 @@ public Item()
}

[DataMember(Name = "href")]
public Uri Href
{
get { return GetValue<Uri>("Href"); }
set { SetValue("Href", value); }
}
public Uri Href { get; set; }

[DataMember(Name = "rel")]
public string Rel
{
get { return GetValue<string>("Rel"); }
set { SetValue("Rel", value); }
}
public string Rel { get; set; }

[DataMember(Name = "rt")]
public string Rt
{
get { return GetValue<string>("Rt"); }
set { SetValue("Rt", value); }
}
public string Rt { get; set; }

[DataMember(Name = "data")]
public IList<Data> Data
{
get { return GetValue<IList<Data>>("Data"); }
private set { SetValue("Data", value); }
}
public IList<Data> Data { get; private set; }

[DataMember(Name = "links")]
public IList<Link> Links
{
get { return GetValue<IList<Link>>("Links"); }
private set { SetValue("Links", value); }
}
public IList<Link> Links { get; private set; }

}
}
24 changes: 4 additions & 20 deletions src/WebApiContrib.CollectionJson/Link.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,15 @@ namespace WebApiContrib.CollectionJson
public class Link : ExtensibleObject
{
[DataMember(Name = "rel")]
public String Rel
{
get { return GetValue<String>("Rel"); }
set { SetValue("Rel", value); }
}
public String Rel { get; set; }

[DataMember(Name = "href")]
public Uri Href
{
get { return GetValue<Uri>("Href"); }
set { SetValue("Href", value); }
}
public Uri Href { get; set; }

[DataMember(Name = "prompt")]
public String Prompt
{
get { return GetValue<String>("Prompt"); }
set { SetValue("Promot", value); }
}
public String Prompt { get; set; }

[DataMember(Name = "render")]
public String Render
{
get { return GetValue<String>("Render"); }
set { SetValue("Render", value); }
}
public String Render { get; set; }
}
}
30 changes: 5 additions & 25 deletions src/WebApiContrib.CollectionJson/Query.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,18 @@ public Query()
}

[DataMember(Name = "rt")]
public String Rt
{
get { return GetValue<String>("Rt"); }
set { SetValue("Rt", value); }
}
public String Rt { get; set; }

[DataMember(Name = "rel")]
public String Rel
{
get { return GetValue<String>("Rel"); }
set { SetValue("Rel", value); }
}
public String Rel { get; set; }

[DataMember(Name = "href")]
public Uri Href
{
get { return GetValue<Uri>("Href"); }
set { SetValue("Href", value); }
}
public Uri Href { get; set; }

[DataMember(Name = "prompt")]
public string Prompt
{
get { return GetValue<String>("Prompt"); }
set { SetValue("Prompt", value); }
}
public string Prompt { get; set; }

[DataMember(Name = "data")]
public IList<Data> Data
{
get { return GetValue<IList<Data>>("Data"); }
set { SetValue("Data", value); }
}
public IList<Data> Data { get; set; }
}
}
2 changes: 1 addition & 1 deletion src/WebApiContrib.CollectionJson/ReadDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ public ReadDocument()
}

[DataMember(Name = "collection")]
public Collection Collection { get; set; }
public Collection Collection { get; private set; }
}
}
2 changes: 1 addition & 1 deletion src/WebApiContrib.CollectionJson/Template.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public Template()
}

[DataMember(Name = "Data")]
public IList<Data> Data { get; set; }
public IList<Data> Data { get; private set; }
}
}
2 changes: 1 addition & 1 deletion src/WebApiContrib.CollectionJson/WriteDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ namespace WebApiContrib.CollectionJson
public class WriteDocument : IWriteDocument
{
[DataMember(Name = "template")]
public Template Template { get; set; }
public Template Template { get; private set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public TheSetValueMethod()
}

[Fact]
public void WhenValueIsPassedThenShouldSToreTheValue()
public void WhenValueIsPassedThenShouldStoreTheValue()
{
_obj.Members["Test3"].ShouldEqual("TestValue");
}
Expand Down

0 comments on commit 9df3381

Please sign in to comment.