Skip to content

Commit f73f37f

Browse files
committed
Added support for user properties
1 parent 9cc90cf commit f73f37f

14 files changed

+384
-2
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#
2+
# This file is auto-generated, do not edit
3+
#
4+
5+
module RecombeeApiClient
6+
require_relative 'request'
7+
require_relative '../errors'
8+
9+
##
10+
#Adding an user property is somehow equivalent to adding a column to the table of users. The users may be characterized by various properties of different types.
11+
#
12+
class AddUserProperty < ApiRequest
13+
attr_reader :property_name, :type
14+
attr_accessor :timeout
15+
attr_accessor :ensure_https
16+
17+
##
18+
# * *Required arguments*
19+
# - +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.
20+
#
21+
# - +type+ -> Value type of the user property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set`
22+
#
23+
#
24+
def initialize(property_name, type)
25+
@property_name = property_name
26+
@type = type
27+
@timeout = 1000
28+
@ensure_https = false
29+
end
30+
31+
# HTTP method
32+
def method
33+
:put
34+
end
35+
36+
# Values of body parameters as a Hash
37+
def body_parameters
38+
p = Hash.new
39+
p
40+
end
41+
42+
# Values of query parameters as a Hash.
43+
# name of parameter => value of the parameter
44+
def query_parameters
45+
params = {}
46+
params['type'] = @type
47+
params
48+
end
49+
50+
# Relative path to the endpoint
51+
def path
52+
"/{databaseId}/users/properties/#{@property_name}"
53+
end
54+
end
55+
end
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#
2+
# This file is auto-generated, do not edit
3+
#
4+
5+
module RecombeeApiClient
6+
require_relative 'request'
7+
require_relative '../errors'
8+
9+
##
10+
#Deleting an user property is roughly equivalent to removing a column from the table of users.
11+
#
12+
class DeleteUserProperty < ApiRequest
13+
attr_reader :property_name
14+
attr_accessor :timeout
15+
attr_accessor :ensure_https
16+
17+
##
18+
# * *Required arguments*
19+
# - +property_name+ -> Name of the property to be deleted.
20+
#
21+
def initialize(property_name)
22+
@property_name = property_name
23+
@timeout = 1000
24+
@ensure_https = false
25+
end
26+
27+
# HTTP method
28+
def method
29+
:delete
30+
end
31+
32+
# Values of body parameters as a Hash
33+
def body_parameters
34+
p = Hash.new
35+
p
36+
end
37+
38+
# Values of query parameters as a Hash.
39+
# name of parameter => value of the parameter
40+
def query_parameters
41+
params = {}
42+
params
43+
end
44+
45+
# Relative path to the endpoint
46+
def path
47+
"/{databaseId}/users/properties/#{@property_name}"
48+
end
49+
end
50+
end
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#
2+
# This file is auto-generated, do not edit
3+
#
4+
5+
module RecombeeApiClient
6+
require_relative 'request'
7+
require_relative '../errors'
8+
9+
##
10+
#Gets information about specified user property.
11+
#
12+
class GetUserPropertyInfo < ApiRequest
13+
attr_reader :property_name
14+
attr_accessor :timeout
15+
attr_accessor :ensure_https
16+
17+
##
18+
# * *Required arguments*
19+
# - +property_name+ -> Name of the property about which the information is to be retrieved.
20+
#
21+
def initialize(property_name)
22+
@property_name = property_name
23+
@timeout = 1000
24+
@ensure_https = false
25+
end
26+
27+
# HTTP method
28+
def method
29+
:get
30+
end
31+
32+
# Values of body parameters as a Hash
33+
def body_parameters
34+
p = Hash.new
35+
p
36+
end
37+
38+
# Values of query parameters as a Hash.
39+
# name of parameter => value of the parameter
40+
def query_parameters
41+
params = {}
42+
params
43+
end
44+
45+
# Relative path to the endpoint
46+
def path
47+
"/{databaseId}/users/properties/#{@property_name}"
48+
end
49+
end
50+
end
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#
2+
# This file is auto-generated, do not edit
3+
#
4+
5+
module RecombeeApiClient
6+
require_relative 'request'
7+
require_relative '../errors'
8+
9+
##
10+
#Get all the current property values of a given user.
11+
#
12+
class GetUserValues < ApiRequest
13+
attr_reader :user_id
14+
attr_accessor :timeout
15+
attr_accessor :ensure_https
16+
17+
##
18+
# * *Required arguments*
19+
# - +user_id+ -> ID of the user properties of which are to be obtained.
20+
#
21+
#
22+
def initialize(user_id)
23+
@user_id = user_id
24+
@timeout = 1000
25+
@ensure_https = false
26+
end
27+
28+
# HTTP method
29+
def method
30+
:get
31+
end
32+
33+
# Values of body parameters as a Hash
34+
def body_parameters
35+
p = Hash.new
36+
p
37+
end
38+
39+
# Values of query parameters as a Hash.
40+
# name of parameter => value of the parameter
41+
def query_parameters
42+
params = {}
43+
params
44+
end
45+
46+
# Relative path to the endpoint
47+
def path
48+
"/{databaseId}/users/#{@user_id}"
49+
end
50+
end
51+
end
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#
2+
# This file is auto-generated, do not edit
3+
#
4+
5+
module RecombeeApiClient
6+
require_relative 'request'
7+
require_relative '../errors'
8+
9+
##
10+
#Gets the list of all the user properties in your database.
11+
#
12+
class ListUserProperties < ApiRequest
13+
14+
attr_accessor :timeout
15+
attr_accessor :ensure_https
16+
17+
##
18+
#
19+
def initialize()
20+
@timeout = 1000
21+
@ensure_https = false
22+
end
23+
24+
# HTTP method
25+
def method
26+
:get
27+
end
28+
29+
# Values of body parameters as a Hash
30+
def body_parameters
31+
p = Hash.new
32+
p
33+
end
34+
35+
# Values of query parameters as a Hash.
36+
# name of parameter => value of the parameter
37+
def query_parameters
38+
params = {}
39+
params
40+
end
41+
42+
# Relative path to the endpoint
43+
def path
44+
"/{databaseId}/users/properties/list/"
45+
end
46+
end
47+
end
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#
2+
# This file is auto-generated, do not edit
3+
#
4+
5+
module RecombeeApiClient
6+
require_relative 'request'
7+
require_relative '../errors'
8+
9+
##
10+
#Set/update (some) property values of a given user. The properties (columns) must be previously created by [Add user property](https://docs.recombee.com/api.html#add-user-property).
11+
#
12+
class SetUserValues < ApiRequest
13+
attr_reader :user_id, :values
14+
attr_accessor :timeout
15+
attr_accessor :ensure_https
16+
17+
##
18+
# * *Required arguments*
19+
# - +user_id+ -> ID of the user which will be modified.
20+
#
21+
# - +values+ -> The values for the individual properties.
22+
#
23+
#Example of body:
24+
#```
25+
# {
26+
# "country": "US",
27+
# "sex": "F",
28+
# "!cascadeCreate": true
29+
# }
30+
#```
31+
#
32+
#Special parameter `!cascadeCreate` may be used. It indicates that the user of the given userId should be created if it does not exist in the database, as if the corresponding PUT method was used. Note the exclamation mark (!) at the beginning of the parameter's name to distinguish it from user property names.
33+
#
34+
#
35+
def initialize(user_id, values)
36+
@user_id = user_id
37+
@values = values
38+
@timeout = 1000
39+
@ensure_https = false
40+
end
41+
42+
# HTTP method
43+
def method
44+
:post
45+
end
46+
47+
# Values of body parameters as a Hash
48+
def body_parameters
49+
p = Hash.new
50+
p = p.merge(@values)
51+
p
52+
end
53+
54+
# Values of query parameters as a Hash.
55+
# name of parameter => value of the parameter
56+
def query_parameters
57+
params = {}
58+
params
59+
end
60+
61+
# Relative path to the endpoint
62+
def path
63+
"/{databaseId}/users/#{@user_id}"
64+
end
65+
end
66+
end

lib/recombee_api_client/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module RecombeeApiClient
2-
VERSION = '1.2.5'
2+
VERSION = '1.3'
33
end

spec/api/add_user_property_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# This file is auto-generated, do not edit
3+
#
4+
5+
require 'spec_helper'
6+
require_relative "add_property"
7+
8+
describe RecombeeApiClient::AddUserProperty do
9+
it_behaves_like "add property"
10+
end
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# This file is auto-generated, do not edit
3+
#
4+
5+
require 'spec_helper'
6+
require_relative "delete_property"
7+
8+
describe RecombeeApiClient::DeleteUserProperty do
9+
it_behaves_like "delete property"
10+
end
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# This file is auto-generated, do not edit
3+
#
4+
5+
require 'spec_helper'
6+
require_relative "get_property_info"
7+
8+
describe RecombeeApiClient::GetUserPropertyInfo do
9+
it_behaves_like "get property info"
10+
end

0 commit comments

Comments
 (0)