Class: RecombeeApiClient::Logic
- Defined in:
- lib/recombee_api_client/inputs/logic.rb
Overview
Initializes Logic 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(optional = {}) ⇒ Logic
constructor
-
*Optional arguments (given as hash optional)* -
name-> Name of the logic that should be used -settings-> Parameters passed to the logic.
-
- #to_json(*args) ⇒ Object
Methods included from HashNormalizer
#camelize, #normalize_hash_to_camel_case
Constructor Details
#initialize(optional = {}) ⇒ Logic
-
*Optional arguments (given as hash optional)*
-
name-> Name of the logic that should be used -
settings-> Parameters passed to the logic
-
22 23 24 25 26 27 28 29 30 |
# File 'lib/recombee_api_client/inputs/logic.rb', line 22 def initialize(optional = {}) optional = normalize_hash_to_camel_case(optional) @name = optional['name'] @settings = optional['settings'] @optional = optional @optional.each do |par, _| raise UnknownOptionalParameter.new(par) unless %w[name 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/logic.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/logic.rb', line 14 def settings @settings end |
Instance Method Details
#as_json(_options = {}) ⇒ Object
Return only JSON-serializable primitives.
33 34 35 36 37 38 39 |
# File 'lib/recombee_api_client/inputs/logic.rb', line 33 def as_json( = {}) res = {} res['name'] = @optional['name'] if @optional['name'] res['settings'] = @optional['settings'] if @optional['settings'] res end |
#to_json(*args) ⇒ Object
41 42 43 |
# File 'lib/recombee_api_client/inputs/logic.rb', line 41 def to_json(*args) as_json.to_json(*args) end |