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.



47763
47764
47765
47766
47767
47768
47769
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47763

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.



47761
47762
47763
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47761

def days
  @days
end

#intervalObject (readonly)

Returns the value of attribute interval.



47761
47762
47763
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47761

def interval
  @interval
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



47775
47776
47777
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47775

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

#subtype_to_hashObject



47779
47780
47781
47782
47783
47784
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47779

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

#to_jsonObject



47771
47772
47773
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47771

def to_json
  JSON.dump(to_hash)
end