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 +4 -4
- data/lib/nexosis_api/calendar_jointarget.rb +34 -0
- data/lib/nexosis_api/client.rb +2 -0
- data/lib/nexosis_api/client/views.rb +1 -1
- data/lib/nexosis_api/column_options.rb +10 -6
- data/lib/nexosis_api/dataset_jointarget.rb +18 -0
- data/lib/nexosis_api/join.rb +16 -13
- data/lib/nexosis_api/session.rb +1 -1
- data/lib/nexosis_api/view_data.rb +1 -0
- data/lib/nexosis_api/view_definition.rb +1 -0
- data/nexosisapi.gemspec +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e6d17a2358818ca916178aa8de48d8ebeb711da
|
4
|
+
data.tar.gz: 5d87a2791462658a349c81a155701ff147c2a6fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/nexosis_api/client.rb
CHANGED
@@ -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'
|
@@ -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
|
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
|
-
@
|
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
|
-
|
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
|
-
{
|
30
|
-
|
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
|
data/lib/nexosis_api/join.rb
CHANGED
@@ -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
|
-
@
|
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
|
-
|
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.
|
16
|
-
|
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
|
24
|
-
# @return [
|
25
|
-
attr_accessor :
|
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['
|
43
|
+
hash['columnOptions'] = {}
|
41
44
|
column_options.each do |column|
|
42
|
-
hash['
|
45
|
+
hash['columnOptions'].merge!(column.to_hash)
|
43
46
|
end
|
44
47
|
end
|
45
48
|
if joins.nil? == false
|
data/lib/nexosis_api/session.rb
CHANGED
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.
|
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.
|
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-
|
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
|