Class: RecombeeApiClient::PropertyMetadata
- Defined in:
- lib/recombee_api_client/inputs/property_metadata.rb
Overview
Initializes PropertyMetadata input#
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
Instance Method Summary collapse
-
#as_json(_options = {}) ⇒ Object
Return only JSON-serializable primitives.
-
#initialize(name, optional = {}) ⇒ PropertyMetadata
constructor
-
*Required arguments* -
name-> Name of the [metadata](docs.recombee.com/api/property_roles_metadata#metadata) assigned to the property.
-
- #to_json(*args) ⇒ Object
Methods included from HashNormalizer
#camelize, #normalize_hash_to_camel_case
Constructor Details
#initialize(name, optional = {}) ⇒ PropertyMetadata
-
*Required arguments*
-
name-> Name of the [metadata](docs.recombee.com/api/property_roles_metadata#metadata) assigned to the property.
-
-
*Optional arguments (given as hash optional)*
-
settings-> Optional configuration for this metadata entry.
-
23 24 25 26 27 28 29 30 31 |
# File 'lib/recombee_api_client/inputs/property_metadata.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
#name ⇒ Object (readonly)
Returns the value of attribute name.
14 15 16 |
# File 'lib/recombee_api_client/inputs/property_metadata.rb', line 14 def name @name end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
14 15 16 |
# File 'lib/recombee_api_client/inputs/property_metadata.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_metadata.rb', line 34 def as_json( = {}) 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_metadata.rb', line 42 def to_json(*args) as_json.to_json(*args) end |