nexosis_api 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1603f0780c88198805797b6929b1d81d9a86e6e3
4
- data.tar.gz: 6fe9d4f166b9ababcdce3240540f1501597297ca
3
+ metadata.gz: 1e6d17a2358818ca916178aa8de48d8ebeb711da
4
+ data.tar.gz: 5d87a2791462658a349c81a155701ff147c2a6fc
5
5
  SHA512:
6
- metadata.gz: b444cc72ecf7871697dd5dd55543b9d0702c2546b9dfa9faed0308a4457953c382c8a2e9dae717c6917f63ed1ede0bd1c96a4e843104d5f234910370ef1d3b53
7
- data.tar.gz: c1c789c24817a72fe2897bbc6e23b47ea9af9e1d1e039e8c60f22f09110a7e096a7724386df610bcca3f0dce189201c33185cb754188562d28dc8988039afd4e
6
+ metadata.gz: d732e55a70a52ca2fd0e89d3485ffd0cf338f025b61187f20db0d08671bcbe3419c111054357a4ada9c2954aa818772b1dfa630f60f40792149b583636024054
7
+ data.tar.gz: 7edec30d1bedcc884748f0e568db6a916c5d9f2b47ac3cbef10077294cfb17bb1bb12e5dbea8f98db8a97fa56b4738a73ce758dc3c9bbaf9e6cc20b8779b8840
@@ -0,0 +1,34 @@
1
+ module NexosisApi
2
+ # Specifies the details of a calendar data source to join to
3
+ # @see http://docs.nexosis.com/guides/calendars
4
+ # @since 1.2.3
5
+ class CalendarJoinTarget
6
+ def initialize(cal_join_hash)
7
+ @url = cal_join_hash['url'] unless cal_join_hash.nil?
8
+ @name = cal_join_hash['name'] unless cal_join_hash.nil?
9
+ @timezone = cal_join_hash['timeZone'] unless cal_join_hash.nil?
10
+ end
11
+
12
+ # The location of a public iCal to download as the datasource
13
+ # @return [String]
14
+ attr_accessor :url
15
+
16
+ # The name of a well-known Nexosis calendar.
17
+ # @return [String]
18
+ # @see http://docs.nexosis.com/guides/datasources
19
+ attr_accessor :name
20
+
21
+ # tz-db string name of the timezone of the calendar
22
+ # @return [String]
23
+ # @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
24
+ attr_accessor :timezone
25
+
26
+ def to_hash
27
+ hash = { 'calendar' => {} }
28
+ hash['calendar'].store 'url', url unless url.nil?
29
+ hash['calendar'].store 'name', name unless name.nil?
30
+ hash['calendar'].store 'timeZone', name unless timezone.nil?
31
+ hash
32
+ end
33
+ end
34
+ end
@@ -1,11 +1,13 @@
1
1
  require 'nexosis_api/algorithm_run'
2
2
  require 'nexosis_api/algorithm_selection'
3
3
  require 'nexosis_api/algorithm'
4
+ require 'nexosis_api/calendar_jointarget'
4
5
  require 'nexosis_api/column'
5
6
  require 'nexosis_api/column_options'
6
7
  require 'nexosis_api/column_role'
7
8
  require 'nexosis_api/column_type'
8
9
  require 'nexosis_api/dataset_data'
10
+ require 'nexosis_api/dataset_jointarget'
9
11
  require 'nexosis_api/dataset_model'
10
12
  require 'nexosis_api/dataset_summary'
11
13
  require 'nexosis_api/http_exception'
@@ -3,7 +3,7 @@ module NexosisApi
3
3
  class Client
4
4
  # Views-based API operations
5
5
  # @see http://docs.nexosis.com/
6
- # @since v1.2
6
+ # @since 1.2.0
7
7
  module Views
8
8
  ## List all existing view defintions, optionally limited by
9
9
  # partial name or participating data sources
@@ -1,17 +1,19 @@
1
1
  module NexosisApi
2
2
  # Class for holding the join options on a column in a view-based join
3
- # @since v1.2
3
+ # @since 1.2.0
4
4
  class ColumnOptions
5
5
  # Create a new option for a join column.
6
6
  # @param column_name [String] the name of the original column from the source dataset
7
7
  # @param options_hash [Hash] additional information about how to process the column in a join
8
8
  def initialize(column_name, options_hash)
9
- @name = column_name
9
+ @column_name = column_name
10
10
  @join_interval = NexosisApi::TimeInterval.const_get(options_hash['joinInterval'].upcase) unless options_hash['joinInterval'].nil?
11
11
  @alias = options_hash['alias']
12
12
  end
13
13
 
14
- attr_accessor :name
14
+ # The name of the column on which these options are applied
15
+ # @return [String]
16
+ attr_accessor :column_name
15
17
 
16
18
  # Optional interval of a time series column being joined to another time series
17
19
  # @note not valid outside of join defintion
@@ -26,8 +28,10 @@ module NexosisApi
26
28
  attr_accessor :alias
27
29
 
28
30
  def to_hash
29
- { name => { 'join_interval' => @join_internal.to_s,
30
- 'alias' => @alias.to_s } }
31
+ hash = { column_name => {} }
32
+ hash[column_name]['join_interval'] = join_interval.to_s unless join_interval.nil?
33
+ hash[column_name]['alias'] = @alias.to_s unless @alias.nil?
34
+ hash
31
35
  end
32
36
  end
33
- end
37
+ end
@@ -0,0 +1,18 @@
1
+ module NexosisApi
2
+ # Specifies the name of a dataset to use as the join datasource
3
+ # @see http://docs.nexosis.com/guides/views
4
+ # @since 1.2.3
5
+ class DatasetJoinTarget
6
+ def initialize(ds_join_hash)
7
+ @dataset_name = ds_join_hash['name'] unless ds_join_hash.nil?
8
+ end
9
+
10
+ # The name of the dataset that will be participating in the join
11
+ # @return [String] name of the dataset provided for this join
12
+ attr_accessor :dataset_name
13
+
14
+ def to_hash
15
+ { 'dataSet' => { 'name' => dataset_name } }
16
+ end
17
+ end
18
+ end
@@ -2,27 +2,31 @@
2
2
 
3
3
  module NexosisApi
4
4
  # class to hold a join defintion initialized by a hash of join values
5
+ # @since 1.2.0
5
6
  class Join
6
7
  def initialize(join_hash)
7
8
  join_hash.each do |k, v|
8
9
  if k == 'dataSet'
9
- @dataset_name = v['name'] unless v.nil?
10
+ @join_target = NexosisApi::DatasetJoinTarget.new(v) unless v.nil?
11
+ elsif k == 'calendar'
12
+ @join_target = NexosisApi::CalendarJoinTarget.new(v) unless v.nil?
10
13
  elsif k == 'columnOptions'
11
- @column_options = v unless v.nil?
14
+ next if v.nil?
15
+ @column_options = v.map do |key, option|
16
+ NexosisApi::ColumnOptions.new(key, option)
17
+ end
12
18
  elsif k == 'joins'
13
- joins = []
14
19
  next if v.nil?
15
- v.each do |join|
16
- joins << NexosisApi::Join.new(join)
17
- @joins = joins
20
+ @joins = v.map do |join|
21
+ NexosisApi::Join.new(join)
18
22
  end
19
23
  end
20
24
  end
21
25
  end
22
26
 
23
- # The name of the dataset that will be participating in the join
24
- # @return [String] name of the dataset provided for this join
25
- attr_accessor :dataset_name
27
+ # The details of the data source that will be participating in the join
28
+ # @return [Object] details of the join target
29
+ attr_accessor :join_target
26
30
 
27
31
  # The optional column definition for the join which
28
32
  # defines how columns should be used from the joined dataset
@@ -34,12 +38,11 @@ module NexosisApi
34
38
  attr_accessor :joins
35
39
 
36
40
  def to_hash
37
- hash = {}
38
- hash['dataSet'] = { name: dataset_name }
41
+ hash = join_target.to_hash
39
42
  if column_options.nil? == false
40
- hash['columns'] = {}
43
+ hash['columnOptions'] = {}
41
44
  column_options.each do |column|
42
- hash['columns'].merge!(column.to_hash)
45
+ hash['columnOptions'].merge!(column.to_hash)
43
46
  end
44
47
  end
45
48
  if joins.nil? == false
@@ -82,7 +82,7 @@ module NexosisApi
82
82
 
83
83
  # The name of the datasource used to run this session
84
84
  # @return [String] - the dataset or view name
85
- # @since v1.2
85
+ # @since 1.2.0
86
86
  attr_accessor :datasource_name
87
87
  end
88
88
  end
@@ -1,5 +1,6 @@
1
1
  module NexosisApi
2
2
  # Class to hold the parsed results of a view data retrieval
3
+ # @since 1.2.0
3
4
  class ViewData < ViewDefinition
4
5
  def initialize(viewdata_hash)
5
6
  @data = viewdata_hash['data']
@@ -1,5 +1,6 @@
1
1
  module NexosisApi
2
2
  # class to hold the parsed results of a view
3
+ # @since 1.2.0
3
4
  class ViewDefinition
4
5
  def initialize(view_hash)
5
6
  view_hash.each do |k, v|
data/nexosisapi.gemspec CHANGED
@@ -16,6 +16,6 @@ Gem::Specification.new do |spec|
16
16
  spec.require_paths = ['lib']
17
17
  spec.required_ruby_version = '>= 2.0.0'
18
18
  spec.summary = "Ruby client for working with the Nexosis API"
19
- spec.version = '1.2.2'
19
+ spec.version = '1.2.3'
20
20
  spec.metadata["yard.run"] = "yri"
21
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexosis_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nexosis,Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-28 00:00:00.000000000 Z
11
+ date: 2017-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -49,6 +49,7 @@ files:
49
49
  - lib/nexosis_api/algorithm.rb
50
50
  - lib/nexosis_api/algorithm_run.rb
51
51
  - lib/nexosis_api/algorithm_selection.rb
52
+ - lib/nexosis_api/calendar_jointarget.rb
52
53
  - lib/nexosis_api/client.rb
53
54
  - lib/nexosis_api/client/datasets.rb
54
55
  - lib/nexosis_api/client/imports.rb
@@ -59,6 +60,7 @@ files:
59
60
  - lib/nexosis_api/column_role.rb
60
61
  - lib/nexosis_api/column_type.rb
61
62
  - lib/nexosis_api/dataset_data.rb
63
+ - lib/nexosis_api/dataset_jointarget.rb
62
64
  - lib/nexosis_api/dataset_model.rb
63
65
  - lib/nexosis_api/dataset_summary.rb
64
66
  - lib/nexosis_api/http_exception.rb