Class: NexosisApi::ImportsResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/nexosis_api/imports_response.rb

Overview

class to parse results from an imports call

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_hash) ⇒ ImportsResponse

Returns a new instance of ImportsResponse.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/nexosis_api/imports_response.rb', line 4

def initialize(response_hash)
  response_hash.each do |k, v|
    if(k == 'importId')
      @import_id = v
    elsif(k == 'requestedDate')
      @requested_date = v
    elsif(k == 'columns')
      columns = []
      next if v.nil?
      v.keys.each do |col_key|
        columns << NexosisApi::Column.new(col_key, v[col_key])
      end
      @column_metadata = columns
    elsif(k == 'links')
      links = []
      v.each { |l| links << NexosisApi::Link.new(l) }
      instance_variable_set("@#{k}", links) unless v.nil?
    elsif k == 'dataSetName'
      @datasource_name = v
    else
      instance_variable_set("@#{k}", v) unless v.nil?
    end
  end
end

Instance Attribute Details

#column_metadataObject

The column descriptors for the data in this session

will reflect either the metadata sent in, defaults form dataset, or inferred values

@return[Array of NexosisApi::Column]



68
69
70
# File 'lib/nexosis_api/imports_response.rb', line 68

def 
  @column_metadata
end

#datasource_nameString

echo back the name of the data source uploaded

Returns:

  • (String)

Since:

  • 1.3.0



50
51
52
# File 'lib/nexosis_api/imports_response.rb', line 50

def datasource_name
  @datasource_name
end

#import_idString

The unique identifier for this import request

Returns:

  • (String)


31
32
33
# File 'lib/nexosis_api/imports_response.rb', line 31

def import_id
  @import_id
end

associated hypermedia

Returns:



72
73
74
# File 'lib/nexosis_api/imports_response.rb', line 72

def links
  @links
end

#messagesArray

Additional details. Normally empty.

Returns:

  • (Array)


63
64
65
# File 'lib/nexosis_api/imports_response.rb', line 63

def messages
  @messages
end

#parametersHash

The S3 parameters used to import a dataset For an S3 response the keys of this hash should be ‘bucket’, ‘path’, and ‘region’

Returns:

  • (Hash)


55
56
57
# File 'lib/nexosis_api/imports_response.rb', line 55

def parameters
  @parameters
end

#requested_dateDateTime

The date of the import request

Returns:

  • (DateTime)


59
60
61
# File 'lib/nexosis_api/imports_response.rb', line 59

def requested_date
  @requested_date
end

#s3String

Where the import was requested from - S3, Azure, or Url

Returns:

  • (String)


35
36
37
# File 'lib/nexosis_api/imports_response.rb', line 35

def s3
  @s3
end

#statusString

Note:

The import will be performed in a FIFO queue. Check back on status before attempting to start a session using the dataset.

The current status of the import request

Returns:

  • (String)


40
41
42
# File 'lib/nexosis_api/imports_response.rb', line 40

def status
  @status
end

#statusHistoryHash

Date and status of each status this session has entered

Returns:

  • (Hash)

Since:

  • 1.3.0



45
46
47
# File 'lib/nexosis_api/imports_response.rb', line 45

def statusHistory
  @statusHistory
end

#typeString

Where the import was requested from - S3, Azure, or Url

Returns:

  • (String)


35
36
37
# File 'lib/nexosis_api/imports_response.rb', line 35

def type
  @type
end