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.
-
#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.
23280 23281 23282 23283 23284 23285 23286 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23280 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)) end |
Instance Attribute Details
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
23278 23279 23280 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23278 def organization @organization end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
23278 23279 23280 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23278 def role @role end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
23278 23279 23280 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23278 def user @user end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
23292 23293 23294 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23292 def copy(incoming={}) MembershipForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
23296 23297 23298 23299 23300 23301 23302 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23296 def to_hash { :organization => organization, :user => user, :role => role.value } end |
#to_json ⇒ Object
23288 23289 23290 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23288 def to_json JSON.dump(to_hash) end |