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_hash_to_camel_case

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.



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

def initialize(filter, changes)
  @filter = filter
  @changes = changes
  @timeout = 100_000
  @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.



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

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



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

def body_parameters
  p = {}
  p['filter'] = @filter
  p['changes'] = @changes

  p
end

#methodObject

HTTP method



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

def method
  :post
end

#pathObject

Relative path to the endpoint



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

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
# File 'lib/recombee_api_client/api/update_more_items.rb', line 53

def query_parameters
  {}
end