Skip to content
This repository has been archived by the owner on Feb 15, 2018. It is now read-only.

Commit

Permalink
Switch to timeseries.create
Browse files Browse the repository at this point in the history
  • Loading branch information
madninja committed Sep 30, 2016
1 parent 6db0993 commit a697f29
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions helium_commander/commands/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def delete(client, label):
all_labels = Label.all(client)
label = [Label.lookup(client, id, resources=all_labels) for id in label]
for entry in label:
result = entry.delete()
click.echo("Deleted: " + entry.id if result else result)
entry.delete()
click.echo("Deleted {} ".format(entry.id))


@cli.command()
Expand Down
5 changes: 3 additions & 2 deletions helium_commander/commands/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def delete(client, sensor, mac, **kwargs):
Deletes the SENSOR with the given id.
"""
sensor = Sensor.lookup(client, sensor, mac=mac)
result = sensor.delete()
click.echo("Deleted" if result else result)
sensor.delete()
click.echo("Deleted {}".format(sensor.id))


cli.add_command(timeseries.cli(Sensor))
4 changes: 2 additions & 2 deletions helium_commander/commands/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ def _list(client, id, **kwargs):
timeseries = islice(timeseries, count)
DataPoint.display(client, timeseries, **kwargs)

@group.command('post')
@group.command('create')
@click.argument('id', metavar=resource_type, required=id_required)
@post_options()
@pass_client
def _post(client, id, **kwargs):
"""Post timeseries readings."""
resource = _fetch_resource(client, id, **kwargs)
timeseries = resource.timeseries()
point = timeseries.post(**kwargs)
point = timeseries.create(**kwargs)
DataPoint.display(client, [point], **kwargs)

@group.command('live')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
author = 'Helium'
author_email = 'hello@helium.com'
install_requires = [
'helium-python>=0.1.8',
'helium-python>=0.2.0',
'future>=0.15',
'dpath>=1.4',
'futures>=3.0',
Expand Down
4 changes: 2 additions & 2 deletions tests/commands/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ def test_timeseries(client, tmp_sensor):
tmp_sensor.short_id])
assert output is not None

output = cli_run(client, ['sensor', 'timeseries', 'post',
output = cli_run(client, ['sensor', 'timeseries', 'create',
tmp_sensor.short_id, 'test_post', '22'])
assert '22' in output

output = cli_run(client, ['sensor', 'timeseries', 'post',
output = cli_run(client, ['sensor', 'timeseries', 'create',
tmp_sensor.short_id, 'test_foo', '42'])
assert '42' in output

Expand Down

0 comments on commit a697f29

Please sign in to comment.