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.



63672
63673
63674
63675
63676
63677
63678
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63672

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.



63670
63671
63672
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63670

def days
  @days
end

#intervalObject (readonly)

Returns the value of attribute interval.



63670
63671
63672
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63670

def interval
  @interval
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



63684
63685
63686
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63684

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

#subtype_to_hashObject



63688
63689
63690
63691
63692
63693
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63688

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

#to_jsonObject



63680
63681
63682
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63680

def to_json
  JSON.dump(to_hash)
end