Class: WCC::Arena::ProfileMemberSaveData
- Inherits:
-
Object
- Object
- WCC::Arena::ProfileMemberSaveData
- Defined in:
- lib/wcc/arena/profile_member_save.rb
Constant Summary collapse
- TIME_FORMAT =
"%Y-%m-%dT%H:%M:%S.%L"- NEVER =
Time.local(9999, 12, 31, 23, 59, 59, 997000)
- ATTRIBUTE_MAP =
{ "active_at" => "DateActive", "pending_at" => "DatePending", }
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
- #arena_attributes(now = Time.now) ⇒ Object
-
#initialize(attributes = {}) ⇒ ProfileMemberSaveData
constructor
A new instance of ProfileMemberSaveData.
- #to_xml ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ ProfileMemberSaveData
Returns a new instance of ProfileMemberSaveData.
51 52 53 |
# File 'lib/wcc/arena/profile_member_save.rb', line 51 def initialize(attributes={}) @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
41 42 43 |
# File 'lib/wcc/arena/profile_member_save.rb', line 41 def attributes @attributes end |
Instance Method Details
#arena_attributes(now = Time.now) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/wcc/arena/profile_member_save.rb', line 55 def arena_attributes(now = Time.now) { "DateActive" => now, "DateDormant" => NEVER, "DateInReview" => NEVER, "DatePending" => now, "MemberNotes" => nil, "PrerequisitesMet" => false, "SourceID" => 272, "SourceValue" => "Unknown", "StatusID" => 255, "StatusReason" => nil, "StatusValue" => "Connected", }.merge(mapped_attributes) end |
#to_xml ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/wcc/arena/profile_member_save.rb', line 71 def to_xml doc = Nokogiri::XML::Builder.new doc.ProfileMember do |root| arena_attributes.each do |key, value| case value when nil root.send key when Time root.send key, value.strftime(TIME_FORMAT) else root.send key, value end end end doc.to_xml end |