predictionio 0.9.6 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/predictionio.rb +15 -0
- data/lib/predictionio/async_request.rb +15 -0
- data/lib/predictionio/async_response.rb +15 -0
- data/lib/predictionio/connection.rb +15 -0
- data/lib/predictionio/engine_client.rb +15 -0
- data/lib/predictionio/event_client.rb +50 -3
- data/lib/predictionio/file_exporter.rb +15 -0
- data/lib/predictionio/version.rb +16 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c31fd8af27761c4128dc5973afc203fd174ca91
|
4
|
+
data.tar.gz: eb0af012acd7198fdd92863a82b87b97356e6506
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f21e0b976a8152c0413b53c9f4bbca362e1d588bc2161bea1b91719141c67143db51e1cb9a8d5e2d3763a604274da595e14ec2982d47a172e966d6a5da2a2635
|
7
|
+
data.tar.gz: e1f637c7269545f89a817bdc57c63d478c43c5078e2cc4c1a05491d993826b0b74a21ad954eb3f8e01c3c7880bdf597874dc3cf6e2284972a694f18bb9128224
|
data/lib/predictionio.rb
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright ownership.
|
4
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
# (the "License"); you may not use this file except in compliance with
|
6
|
+
# the License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
1
16
|
require 'json'
|
2
17
|
require 'predictionio/async_request'
|
3
18
|
require 'predictionio/async_response'
|
@@ -1,3 +1,18 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright ownership.
|
4
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
# (the "License"); you may not use this file except in compliance with
|
6
|
+
# the License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
1
16
|
module PredictionIO
|
2
17
|
# This class contains the URI path and query parameters that is consumed by
|
3
18
|
# PredictionIO::Connection for asynchronous HTTP requests.
|
@@ -1,3 +1,18 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright ownership.
|
4
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
# (the "License"); you may not use this file except in compliance with
|
6
|
+
# the License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
1
16
|
require 'thread'
|
2
17
|
|
3
18
|
module PredictionIO
|
@@ -1,3 +1,18 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright ownership.
|
4
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
# (the "License"); you may not use this file except in compliance with
|
6
|
+
# the License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
1
16
|
module PredictionIO
|
2
17
|
|
3
18
|
# This class handles multithreading and asynchronous requests transparently for the REST client.
|
@@ -1,3 +1,18 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright ownership.
|
4
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
# (the "License"); you may not use this file except in compliance with
|
6
|
+
# the License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
1
16
|
# Ruby SDK for convenient access of PredictionIO Output API.
|
2
17
|
#
|
3
18
|
# Author:: PredictionIO Team (support@prediction.io)
|
@@ -1,3 +1,18 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright ownership.
|
4
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
# (the "License"); you may not use this file except in compliance with
|
6
|
+
# the License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
1
16
|
# Ruby SDK for convenient access of PredictionIO Output API.
|
2
17
|
#
|
3
18
|
# Author:: PredictionIO Team (support@prediction.io)
|
@@ -6,6 +21,7 @@
|
|
6
21
|
|
7
22
|
require 'date'
|
8
23
|
require "net/http"
|
24
|
+
require 'active_support/core_ext/hash'
|
9
25
|
|
10
26
|
module PredictionIO
|
11
27
|
# This class contains methods that interface with the PredictionIO Event
|
@@ -110,13 +126,31 @@ module PredictionIO
|
|
110
126
|
#
|
111
127
|
# See also #create_event.
|
112
128
|
def acreate_event(event, entity_type, entity_id, optional = {})
|
113
|
-
h = optional
|
114
|
-
h.key?('eventTime') || h['eventTime'] = DateTime.now.
|
129
|
+
h = optional.with_indifferent_access
|
130
|
+
h.key?('eventTime') || h['eventTime'] = DateTime.now.iso8601
|
115
131
|
h['event'] = event
|
116
132
|
h['entityType'] = entity_type
|
117
133
|
h['entityId'] = entity_id
|
134
|
+
@http.apost(PredictionIO::AsyncRequest.new(event_path_with_main_params(h), h.except(:channel).to_json))
|
135
|
+
end
|
136
|
+
|
137
|
+
def event_path_with_main_params(options)
|
138
|
+
result = "/events.json?accessKey=#{@access_key}"
|
139
|
+
result += "&channel=#{options[:channel]}" if options[:channel]
|
140
|
+
|
141
|
+
result
|
142
|
+
end
|
143
|
+
|
144
|
+
# :category: Asynchronous Methods
|
145
|
+
# Asynchronously request to create a batch of event and return a
|
146
|
+
# PredictionIO::AsyncResponse object immediately.
|
147
|
+
#
|
148
|
+
# Corresponding REST API method: POST /batch/events.json
|
149
|
+
#
|
150
|
+
# See also #acreate_event.
|
151
|
+
def acreate_batch_event(payload)
|
118
152
|
@http.apost(PredictionIO::AsyncRequest.new(
|
119
|
-
"/events.json?accessKey=#{@access_key}",
|
153
|
+
"/batch/events.json?accessKey=#{@access_key}", payload.to_json
|
120
154
|
))
|
121
155
|
end
|
122
156
|
|
@@ -133,6 +167,19 @@ module PredictionIO
|
|
133
167
|
sync_events(:acreate_event, *args)
|
134
168
|
end
|
135
169
|
|
170
|
+
# :category: Synchronous Methods
|
171
|
+
# Synchronously request to create an event and block until a response is
|
172
|
+
# received.
|
173
|
+
#
|
174
|
+
# See also #acreate_event.
|
175
|
+
#
|
176
|
+
# call-seq:
|
177
|
+
# create_batch_event(payload)
|
178
|
+
# create_batch_event(async_response)
|
179
|
+
def create_batch_event(payload)
|
180
|
+
sync_events(:acreate_batch_event, payload)
|
181
|
+
end
|
182
|
+
|
136
183
|
# :category: Asynchronous Methods
|
137
184
|
# Asynchronously request to set properties of a user and return a
|
138
185
|
# PredictionIO::AsyncResponse object immediately.
|
@@ -1,3 +1,18 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright ownership.
|
4
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
# (the "License"); you may not use this file except in compliance with
|
6
|
+
# the License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
1
16
|
module PredictionIO
|
2
17
|
# This class contains methods that allow you to export data for import though:
|
3
18
|
#
|
data/lib/predictionio/version.rb
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright ownership.
|
4
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
# (the "License"); you may not use this file except in compliance with
|
6
|
+
# the License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
1
16
|
module PredictionIO
|
2
|
-
VERSION = '0.
|
17
|
+
VERSION = '0.12.0'
|
3
18
|
end
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: predictionio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The PredictionIO Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.8'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.8'
|
27
27
|
description: |
|
@@ -54,7 +54,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
54
54
|
requirements:
|
55
55
|
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version:
|
57
|
+
version: '2.0'
|
58
58
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - ">="
|
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
version: '0'
|
63
63
|
requirements: []
|
64
64
|
rubyforge_project:
|
65
|
-
rubygems_version: 2.
|
65
|
+
rubygems_version: 2.2.2
|
66
66
|
signing_key:
|
67
67
|
specification_version: 4
|
68
68
|
summary: PredictionIO Ruby SDK
|