Class: Sift::Client::Decision::ApplyTo

Inherits:
Object
  • Object
show all
Defined in:
lib/sift/client/decision/apply_to.rb

Constant Summary collapse

PROPERTIES =
%w{ source analyst description order_id user_id account_id }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key, decision_id, configs) ⇒ ApplyTo

Returns a new instance of ApplyTo.



24
25
26
27
28
29
# File 'lib/sift/client/decision/apply_to.rb', line 24

def initialize(api_key, decision_id, configs)
  @api_key = api_key
  @decision_id = decision_id
  @configs = configs
  @getter = Utils::HashGetter.new(configs)
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



14
15
16
# File 'lib/sift/client/decision/apply_to.rb', line 14

def api_key
  @api_key
end

#configsObject (readonly)

Returns the value of attribute configs.



14
15
16
# File 'lib/sift/client/decision/apply_to.rb', line 14

def configs
  @configs
end

#decision_idObject (readonly)

Returns the value of attribute decision_id.



14
15
16
# File 'lib/sift/client/decision/apply_to.rb', line 14

def decision_id
  @decision_id
end

#getterObject (readonly)

Returns the value of attribute getter.



14
15
16
# File 'lib/sift/client/decision/apply_to.rb', line 14

def getter
  @getter
end

Instance Method Details

#runObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/sift/client/decision/apply_to.rb', line 31

def run
  if errors.empty?
    send_request
  else
    Response.new(
      MultiJson.dump({
        status: 55,
        error_message: errors.join(", ")
      }),
      400,
      nil
    )
  end
end