Class: Io::Flow::V0::Models::OrderServiceChangeRequest

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

Returns a new instance of OrderServiceChangeRequest.



41237
41238
41239
41240
41241
41242
41243
41244
41245
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41237

def initialize(incoming={})
  super(:discriminator => Event::Types::ORDER_SERVICE_CHANGE_REQUEST)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :request], 'OrderServiceChangeRequest')
  @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)
  @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String)
  @request = (x = opts.delete(:request); x.is_a?(::Io::Flow::V0::Models::OrderServiceChangeRequestData) ? x : ::Io::Flow::V0::Models::OrderServiceChangeRequestData.new(x))
end

Instance Attribute Details

#event_idObject (readonly)

Returns the value of attribute event_id.



41235
41236
41237
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41235

def event_id
  @event_id
end

#organizationObject (readonly)

Returns the value of attribute organization.



41235
41236
41237
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41235

def organization
  @organization
end

#requestObject (readonly)

Returns the value of attribute request.



41235
41236
41237
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41235

def request
  @request
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



41235
41236
41237
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41235

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



41251
41252
41253
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41251

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

#subtype_to_hashObject



41255
41256
41257
41258
41259
41260
41261
41262
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41255

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :request => request.to_hash
  }
end

#to_jsonObject



41247
41248
41249
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41247

def to_json
  JSON.dump(to_hash)
end