Class: Io::Flow::V0::Models::RepeatWeekly

Inherits:
RepeatSchedule show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Attributes inherited from RepeatSchedule

#discriminator

Instance Method Summary collapse

Methods inherited from RepeatSchedule

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ RepeatWeekly

Returns a new instance of RepeatWeekly.



59010
59011
59012
59013
59014
59015
59016
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59010

def initialize(incoming={})
  super(:discriminator => RepeatSchedule::Types::REPEAT_WEEKLY)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:interval, :days_of_week], 'RepeatWeekly')
  @interval = HttpClient::Preconditions.assert_class('interval', opts.delete(:interval), Integer)
  @days_of_week = HttpClient::Preconditions.assert_class('days_of_week', opts.delete(:days_of_week), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::DayOfWeek) ? x : ::Io::Flow::V0::Models::DayOfWeek.apply(x)) }
end

Instance Attribute Details

#days_of_weekObject (readonly)

Returns the value of attribute days_of_week.



59008
59009
59010
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59008

def days_of_week
  @days_of_week
end

#intervalObject (readonly)

Returns the value of attribute interval.



59008
59009
59010
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59008

def interval
  @interval
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



59022
59023
59024
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59022

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

#subtype_to_hashObject



59026
59027
59028
59029
59030
59031
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59026

def subtype_to_hash
  {
    :interval => interval,
    :days_of_week => days_of_week.map { |o| o.value }
  }
end

#to_jsonObject



59018
59019
59020
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59018

def to_json
  JSON.dump(to_hash)
end