Class: Io::Flow::V0::Models::ProductRestrictionResultUpserted

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

Returns a new instance of ProductRestrictionResultUpserted.



60943
60944
60945
60946
60947
60948
60949
60950
60951
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60943

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

Instance Attribute Details

#event_idObject (readonly)

Returns the value of attribute event_id.



60941
60942
60943
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60941

def event_id
  @event_id
end

#organizationObject (readonly)

Returns the value of attribute organization.



60941
60942
60943
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60941

def organization
  @organization
end

#product_restriction_resultObject (readonly)

Returns the value of attribute product_restriction_result.



60941
60942
60943
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60941

def product_restriction_result
  @product_restriction_result
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



60941
60942
60943
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60941

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



60957
60958
60959
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60957

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

#subtype_to_hashObject



60961
60962
60963
60964
60965
60966
60967
60968
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60961

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

#to_jsonObject



60953
60954
60955
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60953

def to_json
  JSON.dump(to_hash)
end