Class: Keepcon::Entity
- Inherits:
-
Object
- Object
- Keepcon::Entity
- Includes:
- ActionView::Helpers::TagHelper
- Defined in:
- lib/keepcon/entity.rb,
lib/keepcon/entity/response.rb
Defined Under Namespace
Classes: Response
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#instance ⇒ Object
Returns the value of attribute instance.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Entity
constructor
A new instance of Entity.
- #send_data(mode) ⇒ Object
- #to_xml ⇒ Object
- #translate ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Entity
Returns a new instance of Entity.
12 13 14 |
# File 'lib/keepcon/entity.rb', line 12 def initialize(params = {}) params.each { |k, v| send("#{k}=", v) } end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
10 11 12 |
# File 'lib/keepcon/entity.rb', line 10 def context @context end |
#instance ⇒ Object
Returns the value of attribute instance.
10 11 12 |
# File 'lib/keepcon/entity.rb', line 10 def instance @instance end |
Instance Method Details
#send_data(mode) ⇒ Object
27 28 29 |
# File 'lib/keepcon/entity.rb', line 27 def send_data(mode) parse_response(context.client.content_request(to_xml, mode)) end |
#to_xml ⇒ Object
23 24 25 |
# File 'lib/keepcon/entity.rb', line 23 def to_xml Gyoku.xml(xml_hash) end |
#translate ⇒ Object
16 17 18 19 20 21 |
# File 'lib/keepcon/entity.rb', line 16 def translate translation = context.attribute_names.map do |attr_name| [context.translate(attr_name), instance.send(attr_name)] end Hash[translation] end |