README.markdown in socialcastr-0.0.1 vs README.markdown in socialcastr-0.1.0
- old
+ new
@@ -2,33 +2,56 @@
SocialCast gem is a ruby interface to the SocialCast REST API
## INSTALLATION
- gem install socialcast4r
+ gem install socialcastr
## Usage
+ # configure the connection
Socialcastr.configuration do |socialcast|
socialcast.username = "user@example.com"
socialcast.password = "password"
socialcast.domain = "demo.socialcast.com"
end
+ # obtain an instance of the API (useful to directly issue get, put, post, delete commands)
api = Socialcastr.api
- messages = api.messages
+ # find all messages (currently returns just one page - 20 elements)
+ messages = Socialcastr::Message.find(:all)
+
+ # build a new message object
+ message = Socialcastr::Message.new(
+ :title => "hallo world!",
+ "body" => "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
+ )
- message_params = { "message[title]" => "hallo world!", "message[body]" => "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." }
- reply = api.add_message(message_params)
- message = Socialcastr::Message.parse(reply)
+ message.new? # => true
+ # persist the message to Socialcast
+ message.save
+ # comment a message
+ message.comment! :text => "Hallo world"
+
+ # search for messages
+ messages = Socialcastr::Message.search(:q => "test")
+
+
+
+
## Status
This is just the first draft of the wrapper. It can be improved in many, many ways.
-The API is not completely covered either: a lot of interesing stuff, like (un)liking and attachments have been left out.
+The API is not completely covered either: some of interesing stuff, like message and comments attachments have been left out.
Feel free to help (see Contributing below)
+
+## TODO
+
+* Base
+ * CRUD for nested objects (comments, likes, attachments)
## Contributing to the code (a.k.a. submitting a pull request)
1. Fork the project.
2. Create a topic branch.