Class: Io::Flow::V0::Models::ShopifySyncStatus

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

Returns a new instance of ShopifySyncStatus.



46191
46192
46193
46194
46195
46196
46197
46198
46199
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46191

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:sync_check, :range, :interval_seconds, :total, :buckets], 'ShopifySyncStatus')
  @sync_check = (x = opts.delete(:sync_check); x.is_a?(::Io::Flow::V0::Models::ShopifySyncCheck) ? x : ::Io::Flow::V0::Models::ShopifySyncCheck.apply(x))
  @range = (x = opts.delete(:range); x.is_a?(::Io::Flow::V0::Models::DatetimeRange) ? x : ::Io::Flow::V0::Models::DatetimeRange.new(x))
  @interval_seconds = HttpClient::Preconditions.assert_class('interval_seconds', opts.delete(:interval_seconds), Integer)
  @total = HttpClient::Preconditions.assert_class('total', opts.delete(:total), Integer)
  @buckets = HttpClient::Preconditions.assert_class('buckets', opts.delete(:buckets), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ShopifyEventBucket) ? x : ::Io::Flow::V0::Models::ShopifyEventBucket.from_json(x)) }
end

Instance Attribute Details

#bucketsObject (readonly)

Returns the value of attribute buckets.



46189
46190
46191
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46189

def buckets
  @buckets
end

#interval_secondsObject (readonly)

Returns the value of attribute interval_seconds.



46189
46190
46191
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46189

def interval_seconds
  @interval_seconds
end

#rangeObject (readonly)

Returns the value of attribute range.



46189
46190
46191
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46189

def range
  @range
end

#sync_checkObject (readonly)

Returns the value of attribute sync_check.



46189
46190
46191
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46189

def sync_check
  @sync_check
end

#totalObject (readonly)

Returns the value of attribute total.



46189
46190
46191
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46189

def total
  @total
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



46205
46206
46207
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46205

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

#to_hashObject



46209
46210
46211
46212
46213
46214
46215
46216
46217
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46209

def to_hash
  {
    :sync_check => sync_check.value,
    :range => range.to_hash,
    :interval_seconds => interval_seconds,
    :total => total,
    :buckets => buckets.map { |o| o.to_hash }
  }
end

#to_jsonObject



46201
46202
46203
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46201

def to_json
  JSON.dump(to_hash)
end