Class: SuggestGrid::GetSimilarUsersBody

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/suggest_grid/models/get_similar_users_body.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#method_missing, #respond_to?, #to_hash, #to_json

Constructor Details

#initialize(type = nil, types = nil, user_id = nil, user_ids = nil, from = nil, size = nil, fields = nil, filter = nil, except = nil, additional_properties = {}) ⇒ GetSimilarUsersBody



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/suggest_grid/models/get_similar_users_body.rb', line 59

def initialize(type = nil,
               types = nil,
               user_id = nil,
               user_ids = nil,
               from = nil,
               size = nil,
               fields = nil,
               filter = nil,
               except = nil,
               additional_properties = {})
  @type = type
  @types = types
  @user_id = user_id
  @user_ids = user_ids
  @from = from
  @size = size
  @fields = fields
  @filter = filter
  @except = except

  # Add additional model properties to the instance
  additional_properties.each {|name, value| instance_variable_set("@#{name}", value)}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class SuggestGrid::BaseModel

Instance Attribute Details

#exceptList of String

These user ids that will not be included in the response.



40
41
42
# File 'lib/suggest_grid/models/get_similar_users_body.rb', line 40

def except
  @except
end

#fieldsList of String

The metadata fields to be included in returned user objects.



31
32
33
# File 'lib/suggest_grid/models/get_similar_users_body.rb', line 31

def fields
  @fields
end

#filterArray<String, Boolean>

Contraints on the returned users or items. Filter structure is defined in [the filter parameter documentation](www.suggestgrid.com/docs/advanced-features#filters-parameter).



36
37
38
# File 'lib/suggest_grid/models/get_similar_users_body.rb', line 36

def filter
  @filter
end

#fromInteger

The number of most similar users to be skipped from the response. Defaults to 0.



23
24
25
# File 'lib/suggest_grid/models/get_similar_users_body.rb', line 23

def from
  @from
end

#sizeInteger

The number of users requested. Defaults to 10. Must be between 1 and 10,000 inclusive.



27
28
29
# File 'lib/suggest_grid/models/get_similar_users_body.rb', line 27

def size
  @size
end

#typeString

The type of the query. Similarities will be calculated based on actions of this type.



7
8
9
# File 'lib/suggest_grid/models/get_similar_users_body.rb', line 7

def type
  @type
end

#typesString

The types of the query. Exactly one of type or types parameters must be provided.



11
12
13
# File 'lib/suggest_grid/models/get_similar_users_body.rb', line 11

def types
  @types
end

#user_idString

The user id of the query.



15
16
17
# File 'lib/suggest_grid/models/get_similar_users_body.rb', line 15

def user_id
  @user_id
end

#user_idsList of String

The user ids of the query. Exactly one of user id or user ids parameters must be provided.



19
20
21
# File 'lib/suggest_grid/models/get_similar_users_body.rb', line 19

def user_ids
  @user_ids
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/suggest_grid/models/get_similar_users_body.rb', line 84

def self.from_hash(hash)
  if hash == nil
    nil
  else
    # Extract variables from the hash
    type = hash["type"]
    types = hash["types"]
    user_id = hash["user_id"]
    user_ids = hash["user_ids"]
    from = hash["from"]
    size = hash["size"]
    fields = hash["fields"]
    filter = hash["filter"]
    except = hash["except"]

    # Clean out expected properties from Hash
    names.values.each {|k| hash.delete(k)}

    # Create object from extracted values
    GetSimilarUsersBody.new(type,
                            types,
                            user_id,
                            user_ids,
                            from,
                            size,
                            fields,
                            filter,
                            except,
                            hash)
  end
end

.namesObject

A mapping from model property names to API property names



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/suggest_grid/models/get_similar_users_body.rb', line 43

def self.names
  if @hash.nil?
    @hash = {}
    @hash["type"] = "type"
    @hash["types"] = "types"
    @hash["user_id"] = "user_id"
    @hash["user_ids"] = "user_ids"
    @hash["from"] = "from"
    @hash["size"] = "size"
    @hash["fields"] = "fields"
    @hash["filter"] = "filter"
    @hash["except"] = "except"
  end
  @hash
end