Class: Io::Flow::V0::Models::MembershipForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::MembershipForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Top level resource to create a membership.
Instance Attribute Summary collapse
-
#organization ⇒ Object
readonly
Returns the value of attribute organization.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
-
#roles ⇒ Object
readonly
Returns the value of attribute roles.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ MembershipForm
constructor
A new instance of MembershipForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ MembershipForm
Returns a new instance of MembershipForm.
37897 37898 37899 37900 37901 37902 37903 37904 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37897 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:organization, :user], 'MembershipForm') @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String) @user = HttpClient::Preconditions.assert_class('user', opts.delete(:user), String) @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 = HttpClient::Preconditions.assert_class('roles', (x = opts.delete(:roles); x.nil? ? [] : 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
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
37895 37896 37897 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37895 def organization @organization end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
37895 37896 37897 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37895 def role @role end |
#roles ⇒ Object (readonly)
Returns the value of attribute roles.
37895 37896 37897 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37895 def roles @roles end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
37895 37896 37897 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37895 def user @user end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
37910 37911 37912 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37910 def copy(incoming={}) MembershipForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
37914 37915 37916 37917 37918 37919 37920 37921 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37914 def to_hash { :organization => organization, :user => user, :role => role.value, :roles => roles.map { |o| o.value } } end |
#to_json ⇒ Object
37906 37907 37908 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37906 def to_json JSON.dump(to_hash) end |