File tree Expand file tree Collapse file tree 2 files changed +57
-1
lines changed
Expand file tree Collapse file tree 2 files changed +57
-1
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 11module RecombeeApiClient
2- VERSION = '1.3'
2+ VERSION = '1.3.1 '
33end
You can’t perform that action at this time.
0 commit comments