README.md in dato-0.1.3 vs README.md in dato-0.1.4
- old
+ new
@@ -22,10 +22,49 @@
$ gem install dato
## Usage
-TODO: Write usage instructions here
+```ruby
+client = Dato::Site::Client.new("YOUR_SITE_API_TOKEN")
+
+article_type = client.item_types.create(
+ name: "Article",
+ singleton: false,
+ sortable: false,
+ api_key: "article"
+)
+
+client.fields.create(
+ article_type[:id],
+ api_key: "title",
+ field_type: "string",
+ appeareance: { type: "title" },
+ label: "Title",
+ localized: false,
+ position: 99,
+ hint: "",
+ validators: { required: {} },
+)
+
+client.fields.create(
+ article_type[:id],
+ api_key: "image",
+ field_type: "image",
+ appeareance: nil,
+ label: "Image",
+ localized: false,
+ position: 99,
+ hint: "",
+ validators: { required: {} },
+)
+
+client.items.create(
+ item_type: article_type[:id],
+ title: "First post!",
+ image: client.upload_image("http://i.giphy.com/NXOF5rlaSXdAc.gif")
+)
+```
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.