class Io::Flow::V0::Models::Membership
Represents the users that are part of this organization. Primary purpose is to manage which users have access to the organization’s data and to provide a simple user interface to assign roles and permissions to each member of the organization
Attributes
id[R]
organization[R]
role[R]
roles[R]
user[R]
Public Class Methods
new(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 49696 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :organization, :user, :roles], 'Membership') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @organization = (x = opts.delete(:organization); x.is_a?(::Io::Flow::V0::Models::ExpandableOrganization) ? x : ::Io::Flow::V0::Models::ExpandableOrganization.from_json(x)) @user = (x = opts.delete(:user); x.is_a?(::Io::Flow::V0::Models::ExpandableUser) ? x : ::Io::Flow::V0::Models::ExpandableUser.from_json(x)) @role = (x = opts.delete(:role); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Role) ? x : ::Io::Flow::V0::Models::Role.apply(x))) @roles = HttpClient::Preconditions.assert_class('roles', opts.delete(:roles), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::FlowRole) ? x : ::Io::Flow::V0::Models::FlowRole.apply(x)) } end
Public Instance Methods
copy(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 49710 def copy(incoming={}) Membership.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end
to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 49714 def to_hash { :id => id, :organization => organization.to_hash, :user => user.to_hash, :role => role.nil? ? nil : role.value, :roles => roles.map { |o| o.value } } end
to_json()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 49706 def to_json JSON.dump(to_hash) end