Class: PowerBI::Capacity

Inherits:
Object
  • Object
show all
Defined in:
lib/power-bi/capacity.rb

Instance Attribute Summary

Attributes inherited from Object

#id

Instance Method Summary collapse

Methods inherited from Object

instantiate_from_data, #reload, #set_attributes

Constructor Details

#initialize(tenant, parent, id = nil) ⇒ Capacity

Returns a new instance of Capacity.



4
5
6
# File 'lib/power-bi/capacity.rb', line 4

def initialize(tenant, parent, id = nil)
  super(tenant, id)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PowerBI::Object

Instance Method Details

#data_to_attributes(data) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/power-bi/capacity.rb', line 12

def data_to_attributes(data)
  {
    id: data[:id],
    display_name: data[:displayName],
    sku: data[:sku],
    state: data[:state],
    region: data[:region],
    capacity_user_access_right: data[:capacityUserAccessRight],
    admins: data[:admins],
  }
end

#get_data(id) ⇒ Object



8
9
10
# File 'lib/power-bi/capacity.rb', line 8

def get_data(id)
  @tenant.get("/capacities", {'$filter': "id eq #{id}"})[:value].first
end