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.



47610
47611
47612
47613
47614
47615
47616
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47610

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.



47608
47609
47610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47608

def days
  @days
end

#intervalObject (readonly)

Returns the value of attribute interval.



47608
47609
47610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47608

def interval
  @interval
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



47622
47623
47624
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47622

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

#subtype_to_hashObject



47626
47627
47628
47629
47630
47631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47626

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

#to_jsonObject



47618
47619
47620
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47618

def to_json
  JSON.dump(to_hash)
end