Class: Markety::CustomObject
- Inherits:
-
Object
- Object
- Markety::CustomObject
- Defined in:
- lib/markety/custom_object.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#keys ⇒ Object
Returns the value of attribute keys.
-
#object_type_name ⇒ Object
Returns the value of attribute object_type_name.
Class Method Summary collapse
Instance Method Summary collapse
- #get_key(key_name) ⇒ Object
-
#initialize(object_type_name: "", keys: {}, attributes: {}) ⇒ CustomObject
constructor
A new instance of CustomObject.
- #to_sync_custom_object_hash ⇒ Object
Constructor Details
#initialize(object_type_name: "", keys: {}, attributes: {}) ⇒ CustomObject
Returns a new instance of CustomObject.
6 7 8 9 10 |
# File 'lib/markety/custom_object.rb', line 6 def initialize(object_type_name: "", keys: {}, attributes: {}) @object_type_name = object_type_name @keys = keys @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/markety/custom_object.rb', line 4 def attributes @attributes end |
#keys ⇒ Object
Returns the value of attribute keys.
4 5 6 |
# File 'lib/markety/custom_object.rb', line 4 def keys @keys end |
#object_type_name ⇒ Object
Returns the value of attribute object_type_name.
4 5 6 |
# File 'lib/markety/custom_object.rb', line 4 def object_type_name @object_type_name end |
Class Method Details
.from_marketo_hash(object_type_name, marketo_hash) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/markety/custom_object.rb', line 23 def self.from_marketo_hash(object_type_name, marketo_hash) keys = {} attributes = {} marketo_hash[:custom_obj_key_list][:attribute].each{|attribute| keys[attribute[:attr_name]] = attribute[:attr_value]} marketo_hash[:custom_obj_attribute_list][:attribute].each{|attribute| attributes[attribute[:attr_name]] = attribute[:attr_value]} if marketo_hash[:custom_obj_attribute_list] new(object_type_name: object_type_name, keys: keys, attributes: attributes) end |
Instance Method Details
#get_key(key_name) ⇒ Object
12 13 14 |
# File 'lib/markety/custom_object.rb', line 12 def get_key(key_name) @keys[key_name] end |
#to_sync_custom_object_hash ⇒ Object
16 17 18 19 20 21 |
# File 'lib/markety/custom_object.rb', line 16 def to_sync_custom_object_hash { "customObjKeyList" => key_list, "customObjAttributeList" => attribute_list } end |