Class: Io::Flow::V0::Models::TrackingEventForm

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

Returns a new instance of TrackingEventForm.



54512
54513
54514
54515
54516
54517
54518
54519
54520
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54512

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:tracking_label_id, :timestamp, :status], 'TrackingEventForm')
  @tracking_label_id = HttpClient::Preconditions.assert_class('tracking_label_id', opts.delete(:tracking_label_id), String)
  @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
  @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::TrackingStatus) ? x : ::Io::Flow::V0::Models::TrackingStatus.apply(x))
  @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String))
  @address = (x = opts.delete(:address); x.nil? ? nil : HttpClient::Preconditions.assert_class('address', x, String))
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



54510
54511
54512
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54510

def address
  @address
end

#descriptionObject (readonly)

Returns the value of attribute description.



54510
54511
54512
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54510

def description
  @description
end

#statusObject (readonly)

Returns the value of attribute status.



54510
54511
54512
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54510

def status
  @status
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



54510
54511
54512
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54510

def timestamp
  @timestamp
end

#tracking_label_idObject (readonly)

Returns the value of attribute tracking_label_id.



54510
54511
54512
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54510

def tracking_label_id
  @tracking_label_id
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



54526
54527
54528
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54526

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

#to_hashObject



54530
54531
54532
54533
54534
54535
54536
54537
54538
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54530

def to_hash
  {
    :tracking_label_id => tracking_label_id,
    :timestamp => timestamp,
    :status => status.value,
    :description => description,
    :address => address
  }
end

#to_jsonObject



54522
54523
54524
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54522

def to_json
  JSON.dump(to_hash)
end