adminpanel 3.5.1 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/adminpanel.gemspec +0 -1
- data/app/controllers/adminpanel/analytics_controller.rb +0 -72
- data/config/routes.rb +0 -2
- data/lib/adminpanel.rb +0 -1
- data/lib/adminpanel/version.rb +1 -1
- data/lib/generators/adminpanel/initialize/templates/adminpanel_setup.rb +0 -22
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fdb59448d368da8c225085f44743f4a35b812de6c78d252873d5a024a553c48
|
4
|
+
data.tar.gz: '009c14245a99f08d414a0f0e7835cd6545b3aad971dc51785773404b3ae34472'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ee0f63c62268021b8fb4ba25526e93521f76da85987154c8abc375f7a337a10e5d1b1196df8a62ef79b3499836deab8dae00851eacd09425aa42ebe8c1fced6
|
7
|
+
data.tar.gz: 8028d0f05fa11d72c86e7cc23382c0afff719581f2854e8823e98f6e207e3ab8ff98bbd903619f0c2fc06fb7a618212b89aa9f9ba913f6b1003052e0b6557a1b
|
data/adminpanel.gemspec
CHANGED
@@ -31,7 +31,6 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_runtime_dependency 'friendly_id', '~> 5.1.0', '>= 5.1.0'
|
32
32
|
|
33
33
|
# Implemented APIs
|
34
|
-
spec.add_runtime_dependency 'google-api-client', '~> 0.8.6' # Google analytics
|
35
34
|
spec.add_runtime_dependency 'instagram', '~> 1.1', '>= 1.1.3'
|
36
35
|
spec.add_runtime_dependency 'koala', '2.2.0' # Facebook
|
37
36
|
|
@@ -6,81 +6,9 @@ module Adminpanel
|
|
6
6
|
|
7
7
|
before_action :set_fb_token
|
8
8
|
|
9
|
-
API_VERSION = 'v3'
|
10
|
-
CACHED_API_FILE = "#{Rails.root}/tmp/cache/analytics-#{API_VERSION}.cache"
|
11
|
-
|
12
9
|
def index
|
13
10
|
end
|
14
11
|
|
15
|
-
def google
|
16
|
-
authorize! :read, Adminpanel::Analytic
|
17
|
-
|
18
|
-
unless Adminpanel.analytics_profile_id.nil? || Adminpanel.analytics_key_filename.nil? || Adminpanel.analytics_account_email.nil?
|
19
|
-
service_account_email = Adminpanel.analytics_account_email # Email of service account
|
20
|
-
key_file = "#{Rails.root}/#{Adminpanel.analytics_key_path}/#{Adminpanel.analytics_key_filename}" # File containing your private key
|
21
|
-
key_secret = 'notasecret' # Password to unlock private key
|
22
|
-
profileID = Adminpanel.analytics_profile_id # Analytics profile ID.
|
23
|
-
|
24
|
-
|
25
|
-
client = Google::APIClient.new(
|
26
|
-
:application_name => Adminpanel.analytics_application_name,
|
27
|
-
:application_version => Adminpanel.analytics_application_version
|
28
|
-
)
|
29
|
-
|
30
|
-
analytics = nil
|
31
|
-
# Load cached discovered API, if it exists. This prevents retrieving the
|
32
|
-
# discovery document on every run, saving a round-trip to the discovery service.
|
33
|
-
if File.exists? CACHED_API_FILE
|
34
|
-
File.open(CACHED_API_FILE) do |file|
|
35
|
-
analytics = Marshal.load(file)
|
36
|
-
end
|
37
|
-
else
|
38
|
-
analytics = client.discovered_api('analytics', API_VERSION)
|
39
|
-
File.open(CACHED_API_FILE, 'w') do |file|
|
40
|
-
Marshal.dump(analytics, file)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
key = Google::APIClient::KeyUtils.load_from_pkcs12(key_file, key_secret)
|
45
|
-
client.authorization = Signet::OAuth2::Client.new(
|
46
|
-
:token_credential_uri => 'https://accounts.google.com/o/oauth2/token',
|
47
|
-
:audience => 'https://accounts.google.com/o/oauth2/token',
|
48
|
-
:authorization_uri => 'https://accounts.google.com/o/oauth2/auth',
|
49
|
-
:scope => 'https://www.googleapis.com/auth/analytics.readonly',
|
50
|
-
:issuer => service_account_email,
|
51
|
-
:signing_key => key
|
52
|
-
)
|
53
|
-
# Request a token for our service account
|
54
|
-
client.authorization.fetch_access_token!
|
55
|
-
|
56
|
-
startDate = DateTime.now.prev_day(15).strftime("%Y-%m-%d")
|
57
|
-
endDate = DateTime.now.strftime("%Y-%m-%d")
|
58
|
-
|
59
|
-
visitCount = client.execute(
|
60
|
-
:api_method => analytics.data.ga.get,
|
61
|
-
:parameters => {
|
62
|
-
'ids' => "ga:#{profileID}",
|
63
|
-
'start-date' => startDate,
|
64
|
-
'end-date' => endDate,
|
65
|
-
'dimensions' => "ga:day,ga:month, ga:year",
|
66
|
-
'metrics' => "ga:visits",
|
67
|
-
'sort' => "ga:year,ga:month,ga:day"
|
68
|
-
}
|
69
|
-
)
|
70
|
-
|
71
|
-
@visits = visitCount.data.rows.collect do |r|
|
72
|
-
{
|
73
|
-
date: "#{r[2]}/#{r[1]}/#{r[0]}",
|
74
|
-
visits: r[3]
|
75
|
-
}
|
76
|
-
end
|
77
|
-
end
|
78
|
-
respond_to do |format|
|
79
|
-
format.html
|
80
|
-
format.json {render :json => {:visit_count => @visitCount, :visits => @visits, :visit_dates => @visitDates }}
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
12
|
def instagram
|
85
13
|
authorize! :read, Adminpanel::Analytic
|
86
14
|
if !@instagram_token.nil?
|
data/config/routes.rb
CHANGED
@@ -7,8 +7,6 @@ Adminpanel::Engine.routes.draw do
|
|
7
7
|
when :analytics
|
8
8
|
resources :analytics, only: [:index] do
|
9
9
|
collection do
|
10
|
-
get :google, to: 'analytics#google'
|
11
|
-
|
12
10
|
get :instagram, to:'analytics#instagram'
|
13
11
|
post "instagram/#{I18n.t('routes.comment')}/:id", action: 'comment_to_instagram/:id', to: 'analytics#instagram_comment', as: 'comment_instagram'
|
14
12
|
end
|
data/lib/adminpanel.rb
CHANGED
data/lib/adminpanel/version.rb
CHANGED
@@ -1,26 +1,4 @@
|
|
1
1
|
Adminpanel.setup do |config|
|
2
|
-
### GOOGLE ANALYTICS CONFIGURATIONS ####
|
3
|
-
## This is your website Google Analytics Profile ID
|
4
|
-
# config.analytics_profile_id = '12341234'
|
5
|
-
|
6
|
-
# # This configuration identifies your app with Google.
|
7
|
-
# # You get this from the Google Analytics Dashboard (https://console.developers.google.com), this configuration is required.
|
8
|
-
# config.analytics_account_email = '12345@developer.gserviceaccount.com'
|
9
|
-
|
10
|
-
# # The next configuration is the file used to establish server to server authentication/authorization
|
11
|
-
# # you need to download this file from the Google Developers Console
|
12
|
-
# # and place it inside your application, this configuration is required.
|
13
|
-
# config.analytics_key_filename = '12345ABCDE.p12'
|
14
|
-
|
15
|
-
# # Path to the key file, defaults to config/analytics
|
16
|
-
# config.analytics_key_path = "config/analytics"
|
17
|
-
|
18
|
-
# # Name of the developers Console Application, defaults to AdminPanel
|
19
|
-
# config.analytics_application_name = 'AdminPanel'
|
20
|
-
|
21
|
-
# # Version of the developers Console Application, defaults to 1.0.0
|
22
|
-
# config.analytics_application_version = '1.0.0'
|
23
|
-
|
24
2
|
### FACEBOOK CONFIGURATIONS ###
|
25
3
|
# # Facebook app id
|
26
4
|
# config.fb_app_id = 'f4c3b00k'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adminpanel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jose Ramon Camacho
|
@@ -32,7 +32,7 @@ cert_chain:
|
|
32
32
|
XdmvXYY6Fr9AHqSdbvphaVu+RqBpkBdGUQCcCZ73NjXSUwgJumx1p1A8e4NXrh1e
|
33
33
|
pYh0/Q==
|
34
34
|
-----END CERTIFICATE-----
|
35
|
-
date: 2018-
|
35
|
+
date: 2018-07-24 00:00:00.000000000 Z
|
36
36
|
dependencies:
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: rails
|
@@ -136,20 +136,6 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 5.1.0
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: google-api-client
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - "~>"
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: 0.8.6
|
146
|
-
type: :runtime
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - "~>"
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: 0.8.6
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
140
|
name: instagram
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|