A gem for interacting with BERG's Cloud API v2
Add this line to your application's Gemfile:
gem 'bergcloud'
And then execute:
$ bundle
Or install it yourself as:
$ gem install bergcloud
Get started:
BERGCloud.api_token = 'your_api_token'
Project methods:
project = BERGCloud::Project.new('your_project_id')
# Check if a project is valid
project.valid? #=> true or false
# Claim a device
project.claim('your-claim-code')
# Check a claim status
project.claim_status('your-claim-code')
# Send a command
project.send_command(:device_id => 'your_device_id', :name => 'my-command', :payload => [1, 2, 3])
# List devices
project.devices
# List events
project.events
Event methods:
event = BERGCloud::Event.new('my-event-id')
# Get event information
event.info
Command methods:
command = BERGCloud::Command.new('my-command-id')
# Get command info
command.info
# Remove a command from the queue
command.delete
- Turns out I didn't fix the 422 error last time
- Requests returning 422 shouldn't be classed as errors because they are not failures
- Add a nicer error message for 401, telling you that you forgot to set
BERGCloud.api_token
- Fixes inability to send commands (changes POST encoding to JSON)
- First Release
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request