caseblocks_api

Authenticate with CaseBlocks:

caseblocks = CaseblocksAPI::Client.new("[email protected]", "some_password", "some_url")

Create a new Case:

caseblocks.create_case({:title => "This is a Case!", :due_at => "tomorrow"}, "your_case_type_name")

Find or Create a new Case

*The data included in the document should include the case type unique identifier field, otherwise the case will be created regardless of other cases.

caseblocks.find_or_create_case({:title => "This is a Case!", :due_at => "tomorrow"}, "your_case_type_name")

Searching for cases:

caseblocks.search('CaseTypeName', {telephone_number: '12334', given_name: 'Smith'})

Searching with pagination:

caseblocks.search('CaseTypeName', {given_name: 'Smith'}, page: 0, page_size: 10)

Searching with sorting:

caseblocks.search('CaseTypeName', {given_name: 'Smith'}, sort_by: [{field: 'created_at', direction: 'desc'}]) caseblocks.search('CaseTypeName', {given_name: 'Smith'}, sort_by: [{field: 'created_at', direction: 'asc'}])

Searching for a reduced response:

caseblocks.search('CaseTypeName', {given_name: 'Smith'}, fields: ['id', 'given_name', ''created_at'])

Creating Conversations and messages on a case:

We can create a message on a case by calling create_message. If you include a conversation_id it will be added as a reply to that conversation.

caseblocks.create_message(:author_id => 1, :case_id => "abcdef12345", :subject => "Read this, its awesome!", :body => "This is the body of the message", :recipient_users => [], :recipient_teams => [])

and for a reply

caseblocks.create_message(:author_id => 1, :case_id => "abcdef12345", :subject => "Read this, its awesome!", :body => "This is the body of the message", :recipient_users => [], :recipient_teams => [], :conversation_id => "")

Contributing to caseblocks_api

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright (c) 2012 EmergeAdapt. See LICENSE.txt for further details.