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 white-listing and black-listing for an email address.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ FraudEmailRule

Returns a new instance of FraudEmailRule.



32914
32915
32916
32917
32918
32919
32920
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32914

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.



32912
32913
32914
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32912

def decision
  @decision
end

#emailObject (readonly)

Returns the value of attribute email.



32912
32913
32914
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32912

def email
  @email
end

#idObject (readonly)

Returns the value of attribute id.



32912
32913
32914
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32912

def id
  @id
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



32926
32927
32928
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32926

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

#to_hashObject



32930
32931
32932
32933
32934
32935
32936
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32930

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

#to_jsonObject



32922
32923
32924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32922

def to_json
  JSON.dump(to_hash)
end