Class: Io::Flow::V0::Models::MembershipUpserted

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

Instance Attribute Summary collapse

Attributes inherited from Event

#discriminator

Instance Method Summary collapse

Methods inherited from Event

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ MembershipUpserted

Returns a new instance of MembershipUpserted.



29233
29234
29235
29236
29237
29238
29239
29240
29241
29242
29243
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29233

def initialize(incoming={})
  super(:discriminator => Event::Types::MEMBERSHIP_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :id, :organization, :user_id, :role], 'MembershipUpserted')
  @event_id = HttpClient::Preconditions.assert_class('event_id', opts.delete(:event_id), String)
  @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String)
  @user_id = HttpClient::Preconditions.assert_class('user_id', opts.delete(:user_id), String)
  @role = HttpClient::Preconditions.assert_class('role', opts.delete(:role), String)
end

Instance Attribute Details

#event_idObject (readonly)

Returns the value of attribute event_id.



29231
29232
29233
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29231

def event_id
  @event_id
end

#idObject (readonly)

Returns the value of attribute id.



29231
29232
29233
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29231

def id
  @id
end

#organizationObject (readonly)

Returns the value of attribute organization.



29231
29232
29233
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29231

def organization
  @organization
end

#roleObject (readonly)

Returns the value of attribute role.



29231
29232
29233
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29231

def role
  @role
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



29231
29232
29233
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29231

def timestamp
  @timestamp
end

#user_idObject (readonly)

Returns the value of attribute user_id.



29231
29232
29233
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29231

def user_id
  @user_id
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



29249
29250
29251
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29249

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

#subtype_to_hashObject



29253
29254
29255
29256
29257
29258
29259
29260
29261
29262
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29253

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :id => id,
    :organization => organization,
    :user_id => user_id,
    :role => role
  }
end

#to_jsonObject



29245
29246
29247
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29245

def to_json
  JSON.dump(to_hash)
end