Class: PowerBI::Gateway

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

Instance Attribute Summary collapse

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) ⇒ Gateway

Returns a new instance of Gateway.



5
6
7
8
# File 'lib/power-bi/gateway.rb', line 5

def initialize(tenant, parent, id = nil)
  super(tenant, id)
  @gateway_datasources = GatewayDatasourceArray.new(@tenant, self)
end

Dynamic Method Handling

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

Instance Attribute Details

#gateway_datasourcesObject (readonly)

Returns the value of attribute gateway_datasources.



3
4
5
# File 'lib/power-bi/gateway.rb', line 3

def gateway_datasources
  @gateway_datasources
end

Instance Method Details

#data_to_attributes(data) ⇒ Object



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

def data_to_attributes(data)
  {
    id: data[:id],
    name: data[:name],
    type: data[:type],
    public_key: data[:publicKey],
  }
end

#gateway_datasource(id) ⇒ Object



23
24
25
# File 'lib/power-bi/gateway.rb', line 23

def gateway_datasource(id)
  GatewayDatasource.new(@tenant, self, id)
end

#get_data(id) ⇒ Object



10
11
12
# File 'lib/power-bi/gateway.rb', line 10

def get_data(id)
  @tenant.get("/gateways/#{id}", use_profile: false)
end