recombee_api_client 1.3 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/recombee_api_client/api/set_values.rb +56 -0
- data/lib/recombee_api_client/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4bc519621572e646541d23ca0d6ccf8748344d2
|
4
|
+
data.tar.gz: f57786e0c50990eab3d21ff781448dd012b30bac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e2fda2576c5cdcf35fe48ee23bb3bd5a6360930f8078e3511b394ef6a2bfa5dc9bd98d48c34c337e236ba1f015e0c18eac8903784943e894427d89a4c85e47b
|
7
|
+
data.tar.gz: 053a016e1e4fd90708de1998e1625559e09604a09da9c631f7ce0ac0b5ec997bcf57ea8a2a55e6bdf25a35942bcdb3ec130e3e186454a471853b81c019e49e4e
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module RecombeeApiClient
|
2
|
+
require_relative 'request'
|
3
|
+
require_relative '../errors'
|
4
|
+
|
5
|
+
##
|
6
|
+
#Set/update (some) property values of a given entity.
|
7
|
+
#
|
8
|
+
class SetValues < ApiRequest
|
9
|
+
attr_reader :cascade_create, :values
|
10
|
+
|
11
|
+
##
|
12
|
+
# * *Required arguments*
|
13
|
+
# - +values+ -> The values for the individual properties.
|
14
|
+
#
|
15
|
+
#Example of body:
|
16
|
+
#```
|
17
|
+
# {
|
18
|
+
# "product_description": "4K TV with 3D feature",
|
19
|
+
# "categories": ["Electronics", "Televisions"],
|
20
|
+
# "price_usd": 342,
|
21
|
+
# "in_stock_from": "2016-11-16T08:00Z",
|
22
|
+
# }
|
23
|
+
#```
|
24
|
+
#
|
25
|
+
# * *Optional arguments (given as hash optional)*
|
26
|
+
# - +cascadeCreate+ -> Sets whether the item should be created if not present in the database.
|
27
|
+
#
|
28
|
+
def initialize( values, optional = {})
|
29
|
+
@values = values
|
30
|
+
@cascade_create = optional['cascadeCreate']
|
31
|
+
@optional = optional
|
32
|
+
@optional.each do |par, _|
|
33
|
+
fail UnknownOptionalParameter.new(par) unless ["cascadeCreate"].include? par
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# HTTP method
|
38
|
+
def method
|
39
|
+
:post
|
40
|
+
end
|
41
|
+
|
42
|
+
# Values of body parameters as a Hash
|
43
|
+
def body_parameters
|
44
|
+
result = Hash.new
|
45
|
+
result = result.merge(@values)
|
46
|
+
result['!cascadeCreate'] = true if @cascade_create
|
47
|
+
result
|
48
|
+
end
|
49
|
+
|
50
|
+
# Values of query parameters as a Hash.
|
51
|
+
# name of parameter => value of the parameter
|
52
|
+
def query_parameters
|
53
|
+
Hash.new
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recombee_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ondřej Fiedler
|
@@ -147,6 +147,7 @@ files:
|
|
147
147
|
- lib/recombee_api_client/api/reset_database.rb
|
148
148
|
- lib/recombee_api_client/api/set_item_values.rb
|
149
149
|
- lib/recombee_api_client/api/set_user_values.rb
|
150
|
+
- lib/recombee_api_client/api/set_values.rb
|
150
151
|
- lib/recombee_api_client/api/user_based_recommendation.rb
|
151
152
|
- lib/recombee_api_client/errors.rb
|
152
153
|
- lib/recombee_api_client/version.rb
|