Class: YourMembership::Convert

Inherits:
Base
  • Object
show all
Defined in:
lib/your_membership/convert.rb

Overview

YourMembership Convert Namespace

Class Method Summary collapse

Methods inherited from Base

build_XML_request, new_call_id, post, response_to_array, response_to_array_of_hashes, response_valid?, response_ym_error?

Class Method Details

.ToEasternTime(session, localTime, localGMTBias) ⇒ Hash

Note:

This is probably not necessary as Ruby will happily convert dates.

Converts the given local time to current Eastern Time, factoring in adjustments for Daylight Savings Time.

Parameters:

  • session (YourMembership::Session)
  • localTime (DateTime)

    A DateTime that you want to convert to US/Eastern Time

  • localGMTBias (Integer)

    The Number of hours the local time zone is away from GMT

Returns:

  • (Hash)

    Returns an Hash with ‘Converted’ and ‘ServerGmtBias’

See Also:



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/your_membership/convert.rb', line 12

def self.ToEasternTime(session, localTime, localGMTBias) # rubocop:disable Style/MethodName
  options = {}
  options[:LocalTime] = format_date_string localTime
  options[:LocalGmtBias] = localGMTBias

  response = post('/', :body => build_XML_request('Convert.ToEasternTime', session, options))

  if response_valid? response
    response['YourMembership_Response']['Convert.ToEasternTime']
  end
end