Class: Io::Flow::V0::Models::ReturnPolicyVersion

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ReturnPolicyVersion

Returns a new instance of ReturnPolicyVersion.



49545
49546
49547
49548
49549
49550
49551
49552
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49545

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :timestamp, :type, :return_policy], 'ReturnPolicyVersion')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
  @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::ChangeType) ? x : ::Io::Flow::V0::Models::ChangeType.apply(x))
  @return_policy = (x = opts.delete(:return_policy); x.is_a?(::Io::Flow::V0::Models::ReturnPolicy) ? x : ::Io::Flow::V0::Models::ReturnPolicy.new(x))
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



49543
49544
49545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49543

def id
  @id
end

#return_policyObject (readonly)

Returns the value of attribute return_policy.



49543
49544
49545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49543

def return_policy
  @return_policy
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



49543
49544
49545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49543

def timestamp
  @timestamp
end

#typeObject (readonly)

Returns the value of attribute type.



49543
49544
49545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49543

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



49558
49559
49560
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49558

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

#to_hashObject



49562
49563
49564
49565
49566
49567
49568
49569
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49562

def to_hash
  {
    :id => id,
    :timestamp => timestamp,
    :type => type.value,
    :return_policy => return_policy.to_hash
  }
end

#to_jsonObject



49554
49555
49556
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49554

def to_json
  JSON.dump(to_hash)
end