1
0
Fork 0
mirror of https://github.com/nov/fb_graph2 synced 2023-03-27 23:22:15 -04:00

Added support for App Insights API

This commit is contained in:
Vokhmin Alexey V 2016-02-04 21:37:11 +03:00
parent 3b7908a11b
commit 0b601f8a7e
6 changed files with 853 additions and 1 deletions

View file

@ -1,6 +1,7 @@
module FbGraph2
class App < Node
include Edge::Achievements
include Edge::AppInsights
include Edge::AppLinkHosts
include Edge::AppEventTypes
include Edge::Banned
@ -48,4 +49,4 @@ module FbGraph2
new(:app).authenticate access_token
end
end
end
end

View file

@ -0,0 +1,12 @@
module FbGraph2
class Edge
module AppInsights
def app_insights(metric, params = {})
insights = self.edge :app_insights, params, { edge_scope: metric }
insights.collect! do |insight|
FbGraph2::Struct::AppInsight.new insight
end
end
end
end
end

View file

@ -0,0 +1,10 @@
module FbGraph2
class Struct
class AppInsight < Struct
register_attributes(
raw: [:value],
time: [:time]
)
end
end
end

View file

@ -0,0 +1,19 @@
require 'spec_helper'
describe FbGraph2::Edge::AppInsights do
let(:app) { FbGraph2::App.app('app_token') }
describe '#app_link_hosts' do
it 'should return an Array of FbGraph2::AppInsight' do
mock_graph :get, 'app/app_insights/metric', 'app/app_insights', access_token: 'app_token' do
insights = app.app_insights('metric')
insights.should be_instance_of FbGraph2::Edge
insights.should_not be_blank
insights.each do |host|
host.should be_instance_of FbGraph2::Struct::AppInsight
end
end
end
end
end

View file

@ -0,0 +1,14 @@
require 'spec_helper'
describe FbGraph2::Struct::AppInsight do
let(:app_insight) do
FbGraph2::Struct::AppInsight.new(
time: '2015-07-13T08:00:00+0000',
value: '3'
)
end
subject { app_insight }
its(:time) { should == Time.parse('2015-07-13T08:00:00+0000') }
its(:value) { should == '3' }
end

View file

@ -0,0 +1,796 @@
{
"data": [
{
"time": "2014-12-18T08:00:00+0000",
"value": "0"
},
{
"time": "2014-12-19T08:00:00+0000",
"value": "0"
},
{
"time": "2014-12-20T08:00:00+0000",
"value": "0"
},
{
"time": "2014-12-22T08:00:00+0000",
"value": "0"
},
{
"time": "2014-12-23T08:00:00+0000",
"value": "0"
},
{
"time": "2014-12-24T08:00:00+0000",
"value": "0"
},
{
"time": "2014-12-25T08:00:00+0000",
"value": "0"
},
{
"time": "2014-12-26T08:00:00+0000",
"value": "0"
},
{
"time": "2014-12-27T08:00:00+0000",
"value": "0"
},
{
"time": "2014-12-28T08:00:00+0000",
"value": "0"
},
{
"time": "2014-12-29T08:00:00+0000",
"value": "0"
},
{
"time": "2014-12-30T08:00:00+0000",
"value": "0"
},
{
"time": "2014-12-31T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-01T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-02T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-03T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-04T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-06T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-07T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-08T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-09T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-10T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-11T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-12T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-13T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-14T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-15T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-16T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-17T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-18T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-19T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-20T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-21T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-22T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-23T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-24T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-25T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-26T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-27T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-28T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-29T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-30T08:00:00+0000",
"value": "0"
},
{
"time": "2015-01-31T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-01T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-02T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-03T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-04T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-05T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-06T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-07T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-08T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-09T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-10T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-11T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-12T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-13T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-14T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-15T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-16T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-17T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-18T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-19T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-20T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-21T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-22T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-23T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-24T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-25T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-26T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-27T08:00:00+0000",
"value": "0"
},
{
"time": "2015-02-28T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-01T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-02T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-03T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-04T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-05T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-06T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-07T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-08T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-11T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-12T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-14T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-15T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-16T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-20T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-21T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-23T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-24T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-25T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-26T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-27T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-28T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-29T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-30T08:00:00+0000",
"value": "0"
},
{
"time": "2015-03-31T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-01T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-02T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-03T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-04T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-05T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-06T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-07T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-08T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-09T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-10T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-11T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-12T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-13T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-14T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-15T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-16T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-17T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-18T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-19T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-20T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-21T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-22T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-23T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-24T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-25T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-26T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-27T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-28T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-29T08:00:00+0000",
"value": "0"
},
{
"time": "2015-04-30T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-01T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-02T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-03T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-04T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-05T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-06T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-07T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-08T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-09T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-10T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-11T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-12T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-13T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-14T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-15T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-16T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-17T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-18T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-19T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-20T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-21T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-22T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-23T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-24T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-25T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-26T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-27T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-28T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-29T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-30T08:00:00+0000",
"value": "0"
},
{
"time": "2015-05-31T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-02T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-03T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-04T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-05T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-06T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-07T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-08T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-09T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-10T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-11T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-12T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-13T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-14T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-15T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-16T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-17T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-18T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-19T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-20T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-21T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-22T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-23T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-24T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-25T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-26T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-27T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-28T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-29T08:00:00+0000",
"value": "0"
},
{
"time": "2015-06-30T08:00:00+0000",
"value": "0"
},
{
"time": "2015-07-01T08:00:00+0000",
"value": "0"
},
{
"time": "2015-07-02T08:00:00+0000",
"value": "0"
},
{
"time": "2015-07-03T08:00:00+0000",
"value": "0"
},
{
"time": "2015-07-04T08:00:00+0000",
"value": "0"
},
{
"time": "2015-07-05T08:00:00+0000",
"value": "0"
},
{
"time": "2015-07-06T08:00:00+0000",
"value": "0"
},
{
"time": "2015-07-07T08:00:00+0000",
"value": "0"
},
{
"time": "2015-07-08T08:00:00+0000",
"value": "0"
},
{
"time": "2015-07-09T08:00:00+0000",
"value": "0"
},
{
"time": "2015-07-10T08:00:00+0000",
"value": "3"
},
{
"time": "2015-07-11T08:00:00+0000",
"value": "3"
},
{
"time": "2015-07-12T08:00:00+0000",
"value": "3"
},
{
"time": "2015-07-13T08:00:00+0000",
"value": "3"
}
]
}