Class: Ontraport::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/ontraport/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Response

Returns a new instance of Response.



63
64
65
66
67
# File 'lib/ontraport/response.rb', line 63

def initialize args
  args.each do |key,val|
    instance_variable_set("@#{key}", val) unless val.nil?
  end
end

Instance Attribute Details

#account_idString (readonly)

Account Id

Returns:

  • (String)

    the Id of your ONTRAPORT account



61
# File 'lib/ontraport/response.rb', line 61

attr_reader :code, :data, :updates, :notifications, :account_id, :misc, :name, :fields, :schema_object_id

#codeString (readonly)

Response code

Returns:

  • (String)


61
62
63
# File 'lib/ontraport/response.rb', line 61

def code
  @code
end

#dataArray<Hash{String=>String,NilClass}>, Hash{String=>String,NilClass} (readonly)

A collection containing actual object data returned from the API.

Returns:

  • (Array<Hash{String=>String,NilClass}>, Hash{String=>String,NilClass})

    either a Hash containing keys for each field belonging to the object type, or an array of those



61
# File 'lib/ontraport/response.rb', line 61

attr_reader :code, :data, :updates, :notifications, :account_id, :misc, :name, :fields, :schema_object_id

#fieldsHash{String=>Hash} (readonly)

Describes the field metadata for an object.

Returns:

  • (Hash{String=>Hash})

    a collection where keys correspond to field names, and values are a nested Hash containing the following:

    • ‘alias’ - Human-readable name of the field

    • ‘type’ - type of field. May be one of the following:

      • check

      • country

      • fulldate

      • list

      • longtext

      • numeric

      • price

      • phone

      • state

      • drop

      • text

      • timestamp

      • parent

      • subscription

      • email

      • sms

    • ‘options’ - either an Array or a Hash of options. This is nil unless type is list or drop



61
# File 'lib/ontraport/response.rb', line 61

attr_reader :code, :data, :updates, :notifications, :account_id, :misc, :name, :fields, :schema_object_id

#miscObject (readonly)



61
# File 'lib/ontraport/response.rb', line 61

attr_reader :code, :data, :updates, :notifications, :account_id, :misc, :name, :fields, :schema_object_id

#nameString (readonly)

Name of an object in the schema.

Returns:

  • (String)

    name of the object type, used by the /objects/meta call



61
# File 'lib/ontraport/response.rb', line 61

attr_reader :code, :data, :updates, :notifications, :account_id, :misc, :name, :fields, :schema_object_id

#notificationsArray (readonly)

Returns:

  • (Array)


61
# File 'lib/ontraport/response.rb', line 61

attr_reader :code, :data, :updates, :notifications, :account_id, :misc, :name, :fields, :schema_object_id

#schema_object_idObject (readonly)

Returns the value of attribute schema_object_id.



61
# File 'lib/ontraport/response.rb', line 61

attr_reader :code, :data, :updates, :notifications, :account_id, :misc, :name, :fields, :schema_object_id

#updatesArray (readonly)

Returns:

  • (Array)


61
# File 'lib/ontraport/response.rb', line 61

attr_reader :code, :data, :updates, :notifications, :account_id, :misc, :name, :fields, :schema_object_id