Class: RecombeeApiClient::UpdateMoreItems

Inherits:
ApiRequest
  • Object
show all
Defined in:
lib/recombee_api_client/api/update_more_items.rb

Overview

Updates (some) property values of all the items that pass the filter.

Example: *Setting all the items that are older than a week as unavailable*

```json
  {
    "filter": "'releaseDate' < now() - 7*24*3600",
    "changes": {"available": false}
  }
```

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashNormalizer

#camelize, #normalize_optional

Constructor Details

#initialize(filter, changes) ⇒ UpdateMoreItems

  • *Required arguments*

    • filter -> A [ReQL](docs.recombee.com/reql) expression, which returns ‘true` for the items that shall be updated.

    • changes -> A dictionary where the keys are properties that shall be updated.



31
32
33
34
35
36
# File 'lib/recombee_api_client/api/update_more_items.rb', line 31

def initialize(filter, changes)
  @filter = filter
  @changes = changes
  @timeout = 100000
  @ensure_https = false
end

Instance Attribute Details

#changesObject (readonly)

Returns the value of attribute changes.



22
23
24
# File 'lib/recombee_api_client/api/update_more_items.rb', line 22

def changes
  @changes
end

#ensure_httpsObject

Returns the value of attribute ensure_https.



24
25
26
# File 'lib/recombee_api_client/api/update_more_items.rb', line 24

def ensure_https
  @ensure_https
end

#filterObject (readonly)

Returns the value of attribute filter.



22
23
24
# File 'lib/recombee_api_client/api/update_more_items.rb', line 22

def filter
  @filter
end

#timeoutObject

Returns the value of attribute timeout.



23
24
25
# File 'lib/recombee_api_client/api/update_more_items.rb', line 23

def timeout
  @timeout
end

Instance Method Details

#body_parametersObject

Values of body parameters as a Hash



44
45
46
47
48
49
# File 'lib/recombee_api_client/api/update_more_items.rb', line 44

def body_parameters
  p = Hash.new
  p['filter'] = @filter
  p['changes'] = @changes
  p
end

#methodObject

HTTP method



39
40
41
# File 'lib/recombee_api_client/api/update_more_items.rb', line 39

def method
  :post
end

#pathObject

Relative path to the endpoint



59
60
61
# File 'lib/recombee_api_client/api/update_more_items.rb', line 59

def path
  "/{databaseId}/more-items/"
end

#query_parametersObject

Values of query parameters as a Hash. name of parameter => value of the parameter



53
54
55
56
# File 'lib/recombee_api_client/api/update_more_items.rb', line 53

def query_parameters
  params = {}
  params
end