Class: TACore::Venue

Inherits:
Auth show all
Defined in:
lib/tacore/venue.rb

Overview

> Venue is used to group devices for Clients, Venue could be a location or an area within a location.

It is important to note that all Venue methods require the use a client_id see Client.create.

Instance Attribute Summary

Attributes inherited from Auth

#client, #token

Attributes inherited from Configuration

#api_key, #api_url, #client_id, #client_secret

Class Method Summary collapse

Methods inherited from Auth

login, request

Methods inherited from Configuration

#initialize

Constructor Details

This class inherits a constructor from TACore::Configuration

Class Method Details

.all(token) ⇒ Array<Object, Object>

Display all Venues for the client

Parameters:

  • token (String)

    Client Token after Authentication

  • client_id (String)

    used from Client.create

Returns:

  • (Array<Object, Object>)

    in JSON format



35
36
37
38
# File 'lib/tacore/venue.rb', line 35

def self.all(token)
  # returns all venues that belong to this client
  request(:get, '/venues', {}, {"token": token})
end

.create(token, venue = {}) ⇒ Object

Note:

Venue currently only accepts ‘name’

Create a new Venue

Parameters:

  • token (String)

    Client Token after Authentication

  • venue (Object) (defaults to: {})

    Venue params

Returns:

  • (Object)

    in JSON format



10
11
12
# File 'lib/tacore/venue.rb', line 10

def self.create(token, venue = {})
  request(:post, '/venue', venue, {"token": token})
end

.destroy(token, venue_id) ⇒ Hash, status: 410

This method will permanently remove the venue from the API.

Parameters:

  • token (String)

    Client Token after Authentication

  • client_id (String)

    used from Client.create

  • venue_id (String)

    the Key of the Venue from create

Returns:

  • (Hash, status: 410)

    in JSON format



45
46
47
# File 'lib/tacore/venue.rb', line 45

def self.destroy(token, venue_id)
  request(:delete, '/venue/' + venue_id.to_s,{}, {"token": token})
end

.devices(token, venue_id) ⇒ Hash, status: 200

Get all gateways belonging to the given venue

Parameters:

  • token (String)

    Client Token after Authentication

  • venue_id (String)

    the Key of the Venue from create

Returns:

  • (Hash, status: 200)

    in JSON format



53
54
55
# File 'lib/tacore/venue.rb', line 53

def self.devices(token, venue_id)
  request(:get, '/venue/' + venue_id.to_s + '/devices',{}, {"token": token})
end

.find(token, venue_id) ⇒ Object

Get back Venue information

Parameters:

  • token (String)

    Client Token after Authentication

  • venue_id (String)

    used from create

Returns:

  • (Object)

    in JSON format



27
28
29
# File 'lib/tacore/venue.rb', line 27

def self.find(token, venue_id)
  request(:get, '/venue/' + venue_id.to_s,{}, {"token": token})
end

.update(token, venue_id, venue = {}) ⇒ Object

Note:

Venue currently only accepts ‘name’

Update a Venue.

Parameters:

  • token (String)

    Client Token after Authentication

  • venue (Object) (defaults to: {})

    Venue params

Returns:

  • (Object)

    in JSON format



19
20
21
# File 'lib/tacore/venue.rb', line 19

def self.update(token, venue_id, venue = {})
  request(:put, '/venue/' + venue_id.to_s, venue, {"token": token})
end