Class: Io::Flow::V0::Models::RepeatMonthly

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

Overview

Monthly on the day of each #interval month. Note if you specify a day > 28 and the month does not have that day, the repeat schedule is assumed to be the last day of the month. Common examples are: Monthly on the 1st, monthly on the 15th and 31st, every 3 months on the 1st, etc.

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

Returns a new instance of RepeatMonthly.



58981
58982
58983
58984
58985
58986
58987
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58981

def initialize(incoming={})
  super(:discriminator => RepeatSchedule::Types::REPEAT_MONTHLY)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:interval, :days], 'RepeatMonthly')
  @interval = HttpClient::Preconditions.assert_class('interval', opts.delete(:interval), Integer)
  @days = HttpClient::Preconditions.assert_class('days', opts.delete(:days), Array).map { |v| HttpClient::Preconditions.assert_class('days', v, Integer) }
end

Instance Attribute Details

#daysObject (readonly)

Returns the value of attribute days.



58979
58980
58981
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58979

def days
  @days
end

#intervalObject (readonly)

Returns the value of attribute interval.



58979
58980
58981
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58979

def interval
  @interval
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



58993
58994
58995
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58993

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

#subtype_to_hashObject



58997
58998
58999
59000
59001
59002
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58997

def subtype_to_hash
  {
    :interval => interval,
    :days => days
  }
end

#to_jsonObject



58989
58990
58991
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58989

def to_json
  JSON.dump(to_hash)
end