Class: Io::Flow::V0::Models::PriceBookItemSchedule

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

Overview

Represents schedule applied to a price book item

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ PriceBookItemSchedule

Returns a new instance of PriceBookItemSchedule.



44317
44318
44319
44320
44321
44322
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44317

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:starts_at], 'PriceBookItemSchedule')
  @starts_at = HttpClient::Preconditions.assert_class('starts_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:starts_at)), DateTime)
  @ends_at = (x = opts.delete(:ends_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('ends_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime))
end

Instance Attribute Details

#ends_atObject (readonly)

Returns the value of attribute ends_at.



44315
44316
44317
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44315

def ends_at
  @ends_at
end

#starts_atObject (readonly)

Returns the value of attribute starts_at.



44315
44316
44317
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44315

def starts_at
  @starts_at
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



44328
44329
44330
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44328

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

#to_hashObject



44332
44333
44334
44335
44336
44337
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44332

def to_hash
  {
    :starts_at => starts_at,
    :ends_at => ends_at
  }
end

#to_jsonObject



44324
44325
44326
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44324

def to_json
  JSON.dump(to_hash)
end