Class: Io::Flow::V0::Models::FraudEmailRule

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Rule to apply to enable allow-listing and deny-listing for an email address.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ FraudEmailRule

Returns a new instance of FraudEmailRule.



38314
38315
38316
38317
38318
38319
38320
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38314

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:email, :decision], 'FraudEmailRule')
  @id = (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, String))
  @email = HttpClient::Preconditions.assert_class('email', opts.delete(:email), String)
  @decision = (x = opts.delete(:decision); x.is_a?(::Io::Flow::V0::Models::FraudEmailRuleDecision) ? x : ::Io::Flow::V0::Models::FraudEmailRuleDecision.apply(x))
end

Instance Attribute Details

#decisionObject (readonly)

Returns the value of attribute decision.



38312
38313
38314
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38312

def decision
  @decision
end

#emailObject (readonly)

Returns the value of attribute email.



38312
38313
38314
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38312

def email
  @email
end

#idObject (readonly)

Returns the value of attribute id.



38312
38313
38314
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38312

def id
  @id
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



38326
38327
38328
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38326

def copy(incoming={})
  FraudEmailRule.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



38330
38331
38332
38333
38334
38335
38336
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38330

def to_hash
  {
    :id => id,
    :email => email,
    :decision => decision.value
  }
end

#to_jsonObject



38322
38323
38324
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38322

def to_json
  JSON.dump(to_hash)
end