Class: PowerBI::Object
- Inherits:
-
Object
- Object
- PowerBI::Object
- Defined in:
- lib/power-bi/object.rb
Direct Known Subclasses
Capacity, Dataset, Datasource, Gateway, GatewayDatasource, GatewayDatasourceUser, Page, Parameter, Profile, Refresh, Report, User, Workspace
Defined Under Namespace
Classes: UnkownAttributeError, UnspecifiedIdError
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(tenant, id = nil) ⇒ Object
constructor
A new instance of Object.
- #reload ⇒ Object
- #set_attributes(data) ⇒ Object
Constructor Details
#initialize(tenant, id = nil) ⇒ Object
Returns a new instance of Object.
9 10 11 12 13 14 15 |
# File 'lib/power-bi/object.rb', line 9 def initialize(tenant, id = nil) @id = id @fulfilled = false @not_found = nil @attributes = nil @tenant = tenant end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (private)
51 52 53 54 55 |
# File 'lib/power-bi/object.rb', line 51 def method_missing(method, *args, &block) get_attributes.fetch(method.to_sym) do raise UnkownAttributeError.new "Unknown attribute #{method}" end end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/power-bi/object.rb', line 4 def id @id end |
Class Method Details
.instantiate_from_data(tenant, parent, data) ⇒ Object
30 31 32 33 34 |
# File 'lib/power-bi/object.rb', line 30 def self.instantiate_from_data(tenant, parent, data) o = new(tenant, parent) o.set_attributes(data) o end |
Instance Method Details
#reload ⇒ Object
24 25 26 27 28 |
# File 'lib/power-bi/object.rb', line 24 def reload @fulfilled = false @attributes = nil self end |
#set_attributes(data) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/power-bi/object.rb', line 17 def set_attributes(data) @fulfilled = true @not_found = false @id = data[:id] @attributes = data_to_attributes(data) end |