Class: RecombeeApiClient::PropertyRole

Inherits:
Input
  • Object
show all
Defined in:
lib/recombee_api_client/inputs/property_role.rb

Overview

Initializes PropertyRole input#

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashNormalizer

#camelize, #normalize_hash_to_camel_case

Constructor Details

#initialize(name, optional = {}) ⇒ PropertyRole



23
24
25
26
27
28
29
30
31
# File 'lib/recombee_api_client/inputs/property_role.rb', line 23

def initialize(name, optional = {})
  @name = name
  optional = normalize_hash_to_camel_case(optional)
  @settings = optional['settings']
  @optional = optional
  @optional.each do |par, _|
    raise UnknownOptionalParameter.new(par) unless ['settings'].include? par
  end
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



14
15
16
# File 'lib/recombee_api_client/inputs/property_role.rb', line 14

def name
  @name
end

#settingsObject (readonly)

Returns the value of attribute settings.



14
15
16
# File 'lib/recombee_api_client/inputs/property_role.rb', line 14

def settings
  @settings
end

Instance Method Details

#as_json(_options = {}) ⇒ Object

Return only JSON-serializable primitives.



34
35
36
37
38
39
40
# File 'lib/recombee_api_client/inputs/property_role.rb', line 34

def as_json(_options = {})
  res = {}
  res['name'] = @name
  res['settings'] = @optional['settings'] if @optional['settings']

  res
end

#to_json(*args) ⇒ Object



42
43
44
# File 'lib/recombee_api_client/inputs/property_role.rb', line 42

def to_json(*args)
  as_json.to_json(*args)
end