Class: RecombeeApiClient::AddUserProperty

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

Overview

Adding a user property is somewhat equivalent to adding a column to the table of users. The users may be characterized by various properties of different types.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashNormalizer

#camelize, #normalize_optional

Constructor Details

#initialize(property_name, type) ⇒ AddUserProperty

  • *Required arguments*

    • property_name -> Name of the user property to be created. Currently, the following names are reserved: ‘id`, `userid`, case-insensitively. Also, the length of the property name must not exceed 63 characters.

    • type -> Value type of the user property to be created. One of: ‘int`, `double`, `string`, `boolean`, `timestamp`, `set`.

  • ‘int` - Signed integer number.

  • ‘double` - Floating point number. It uses 64-bit base-2 format (IEEE 754 standard).

  • ‘string` - UTF-8 string.

  • ‘boolean` - true / false

  • ‘timestamp` - Value representing date and time.

  • ‘set` - Set of strings.



36
37
38
39
40
41
# File 'lib/recombee_api_client/api/add_user_property.rb', line 36

def initialize(property_name, type)
  @property_name = property_name
  @type = type
  @timeout = 100000
  @ensure_https = false
end

Instance Attribute Details

#ensure_httpsObject

Returns the value of attribute ensure_https.



15
16
17
# File 'lib/recombee_api_client/api/add_user_property.rb', line 15

def ensure_https
  @ensure_https
end

#property_nameObject (readonly)

Returns the value of attribute property_name.



13
14
15
# File 'lib/recombee_api_client/api/add_user_property.rb', line 13

def property_name
  @property_name
end

#timeoutObject

Returns the value of attribute timeout.



14
15
16
# File 'lib/recombee_api_client/api/add_user_property.rb', line 14

def timeout
  @timeout
end

#typeObject (readonly)

Returns the value of attribute type.



13
14
15
# File 'lib/recombee_api_client/api/add_user_property.rb', line 13

def type
  @type
end

Instance Method Details

#body_parametersObject

Values of body parameters as a Hash



49
50
51
52
# File 'lib/recombee_api_client/api/add_user_property.rb', line 49

def body_parameters
  p = Hash.new
  p
end

#methodObject

HTTP method



44
45
46
# File 'lib/recombee_api_client/api/add_user_property.rb', line 44

def method
  :put
end

#pathObject

Relative path to the endpoint



63
64
65
# File 'lib/recombee_api_client/api/add_user_property.rb', line 63

def path
  "/{databaseId}/users/properties/#{@property_name}"
end

#query_parametersObject

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



56
57
58
59
60
# File 'lib/recombee_api_client/api/add_user_property.rb', line 56

def query_parameters
  params = {}
  params['type'] = @type
  params
end