Class: Io::Flow::V0::Models::EmailRecipient

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ EmailRecipient

Returns a new instance of EmailRecipient.



37778
37779
37780
37781
37782
37783
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37778

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:email], 'EmailRecipient')
  @email = HttpClient::Preconditions.assert_class('email', opts.delete(:email), String)
  @name = (x = opts.delete(:name); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Name) ? x : ::Io::Flow::V0::Models::Name.new(x)))
end

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



37776
37777
37778
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37776

def email
  @email
end

#nameObject (readonly)

Returns the value of attribute name.



37776
37777
37778
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37776

def name
  @name
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



37789
37790
37791
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37789

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

#to_hashObject



37793
37794
37795
37796
37797
37798
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37793

def to_hash
  {
    :email => email,
    :name => name.nil? ? nil : name.to_hash
  }
end

#to_jsonObject



37785
37786
37787
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37785

def to_json
  JSON.dump(to_hash)
end