lib/cs/end_point.rb
# Create a new end point object to CS. It will raise an exception if there is an error
#
# example for {Sensor} object:
#
#     sensor = client.sensors.build
#     sensor.name = "accelerometer"
#     sensor.display_name = "Accelerometer"
#     sensor.device_type = "BMA123"
#     sensor.pager_type = "email"
#     sensor.data_type = "json"
#     sensor.data_structure = {"x-axis" => "Float", "y-axis" => "Float", "z-axis" => "Float"}
#
#     sensor.create! # this will create new sensor on CS
#     sensor.id # should give you the id of the sensor
Create a new end point object to CS. It will raise an exception if there is an error
example for {Sensor} object.




Create a new end point object to CS . It will raise an exception if there is an error example for { Sensor } object .
def create!(options={})
      parameter = self.to_parameters
      parameter.merge!(options)
      res = session.post(post_url, parameter)
      if session.response_code != 201
        errors = session.errors rescue nil
        raise Error::ResponseError, errors
      end
      location_header = session.response_headers["location"]
      id = scan_header_for_id(location_header)
      self.id = id[0] if id
      true
    end
def create! ( options = { } ) parameter = self . to_parameters parameter . merge! ( options ) res = session . post ( post_url , parameter ) if session . response_code != 201 errors = session . errors rescue nil raise Error :: ResponseError , errors end location_header = session . response_headers [ "location" ] id = scan_header_for_id ( location_header ) self . id = id [ 0 ] if id true end
Create a new end point object to CS.
Create a new end point object to CS .
options
<not_specific>