Class: Io::Flow::V0::Models::SyncRecord

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

Returns a new instance of SyncRecord.



64504
64505
64506
64507
64508
64509
64510
64511
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64504

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :system, :value, :stream], 'SyncRecord')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @system = HttpClient::Preconditions.assert_class('system', opts.delete(:system), String)
  @value = HttpClient::Preconditions.assert_class('value', opts.delete(:value), String)
  @stream = (x = opts.delete(:stream); x.is_a?(::Io::Flow::V0::Models::SyncStreamReference) ? x : ::Io::Flow::V0::Models::SyncStreamReference.new(x))
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



64502
64503
64504
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64502

def id
  @id
end

#streamObject (readonly)

Returns the value of attribute stream.



64502
64503
64504
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64502

def stream
  @stream
end

#systemObject (readonly)

Returns the value of attribute system.



64502
64503
64504
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64502

def system
  @system
end

#valueObject (readonly)

Returns the value of attribute value.



64502
64503
64504
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64502

def value
  @value
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



64517
64518
64519
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64517

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

#to_hashObject



64521
64522
64523
64524
64525
64526
64527
64528
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64521

def to_hash
  {
    :id => id,
    :system => system,
    :value => value,
    :stream => stream.to_hash
  }
end

#to_jsonObject



64513
64514
64515
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64513

def to_json
  JSON.dump(to_hash)
end