Class: YandexTracker::Objects::Base
- Inherits:
-
Object
- Object
- YandexTracker::Objects::Base
- Defined in:
- lib/yandex_tracker/objects/base.rb
Overview
Objects::Base
Direct Known Subclasses
Attachment, Category, Comment, Field, Issue, LocalField, Queue, Resolution, User, Workflow
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#expand ⇒ Object
fetch full object from .self.
- #id ⇒ Object
-
#initialize(client, data, context = {}) ⇒ Base
constructor
A new instance of Base.
- #method_missing(name, *args) ⇒ Object
- #respond_to_missing?(name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(client, data, context = {}) ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 16 |
# File 'lib/yandex_tracker/objects/base.rb', line 11 def initialize(client, data, context = {}) @client = client @data = data @context = context refresh_from(data) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/yandex_tracker/objects/base.rb', line 22 def method_missing(name, *args) key = name.to_s return wrap_value(data[key]) if data.key?(key) super end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
9 10 11 |
# File 'lib/yandex_tracker/objects/base.rb', line 9 def client @client end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
9 10 11 |
# File 'lib/yandex_tracker/objects/base.rb', line 9 def context @context end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
9 10 11 |
# File 'lib/yandex_tracker/objects/base.rb', line 9 def data @data end |
Instance Method Details
#expand ⇒ Object
fetch full object from .self
34 35 36 37 38 39 |
# File 'lib/yandex_tracker/objects/base.rb', line 34 def return self unless data["self"] response = client.conn.get(data["self"]).body refresh_from(response) end |
#id ⇒ Object
18 19 20 |
# File 'lib/yandex_tracker/objects/base.rb', line 18 def id data["id"] end |
#respond_to_missing?(name, include_private = false) ⇒ Boolean
29 30 31 |
# File 'lib/yandex_tracker/objects/base.rb', line 29 def respond_to_missing?(name, include_private = false) data.key?(name.to_s) || super end |