Class: Io::Flow::V0::Models::InvitationForm

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 = {}) ⇒ InvitationForm

Returns a new instance of InvitationForm.



46702
46703
46704
46705
46706
46707
46708
46709
46710
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46702

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:organization, :email], 'InvitationForm')
  @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String)
  @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)))
  @role = (x = (x = opts.delete(:role); x.nil? ? "member" : x); x.is_a?(::Io::Flow::V0::Models::Role) ? x : ::Io::Flow::V0::Models::Role.apply(x))
  @roles = (x = opts.delete(:roles); x.nil? ? nil : HttpClient::Preconditions.assert_class('roles', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::FlowRole) ? x : ::Io::Flow::V0::Models::FlowRole.apply(x)) })
end

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



46700
46701
46702
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46700

def email
  @email
end

#nameObject (readonly)

Returns the value of attribute name.



46700
46701
46702
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46700

def name
  @name
end

#organizationObject (readonly)

Returns the value of attribute organization.



46700
46701
46702
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46700

def organization
  @organization
end

#roleObject (readonly)

Returns the value of attribute role.



46700
46701
46702
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46700

def role
  @role
end

#rolesObject (readonly)

Returns the value of attribute roles.



46700
46701
46702
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46700

def roles
  @roles
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



46716
46717
46718
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46716

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

#to_hashObject



46720
46721
46722
46723
46724
46725
46726
46727
46728
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46720

def to_hash
  {
    :organization => organization,
    :email => email,
    :name => name.nil? ? nil : name.to_hash,
    :role => role.value,
    :roles => roles.nil? ? nil : roles.map { |o| o.value }
  }
end

#to_jsonObject



46712
46713
46714
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46712

def to_json
  JSON.dump(to_hash)
end