Class: Io::Flow::V0::Models::SyncStream

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

Returns a new instance of SyncStream.



52674
52675
52676
52677
52678
52679
52680
52681
52682
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52674

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :key, :type, :systems, :settings], 'SyncStream')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::SyncStreamType) ? x : ::Io::Flow::V0::Models::SyncStreamType.apply(x))
  @systems = HttpClient::Preconditions.assert_class('systems', opts.delete(:systems), Array).map { |v| HttpClient::Preconditions.assert_class('systems', v, String) }
  @settings = (x = opts.delete(:settings); x.is_a?(::Io::Flow::V0::Models::SyncStreamSettings) ? x : ::Io::Flow::V0::Models::SyncStreamSettings.new(x))
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



52672
52673
52674
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52672

def id
  @id
end

#keyObject (readonly)

Returns the value of attribute key.



52672
52673
52674
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52672

def key
  @key
end

#settingsObject (readonly)

Returns the value of attribute settings.



52672
52673
52674
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52672

def settings
  @settings
end

#systemsObject (readonly)

Returns the value of attribute systems.



52672
52673
52674
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52672

def systems
  @systems
end

#typeObject (readonly)

Returns the value of attribute type.



52672
52673
52674
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52672

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



52688
52689
52690
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52688

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

#to_hashObject



52692
52693
52694
52695
52696
52697
52698
52699
52700
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52692

def to_hash
  {
    :id => id,
    :key => key,
    :type => type.value,
    :systems => systems,
    :settings => settings.to_hash
  }
end

#to_jsonObject



52684
52685
52686
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52684

def to_json
  JSON.dump(to_hash)
end