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.



52389
52390
52391
52392
52393
52394
52395
52396
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52389

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.



52387
52388
52389
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52387

def id
  @id
end

#streamObject (readonly)

Returns the value of attribute stream.



52387
52388
52389
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52387

def stream
  @stream
end

#systemObject (readonly)

Returns the value of attribute system.



52387
52388
52389
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52387

def system
  @system
end

#valueObject (readonly)

Returns the value of attribute value.



52387
52388
52389
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52387

def value
  @value
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



52402
52403
52404
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52402

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

#to_hashObject



52406
52407
52408
52409
52410
52411
52412
52413
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52406

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

#to_jsonObject



52398
52399
52400
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52398

def to_json
  JSON.dump(to_hash)
end