pirsch_api 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b41470047653a8abd5e3eff60fe44bef1d2afb51c82279ef48879be999fc8243
4
- data.tar.gz: fdb4e7546d50d6049f48e727781ecb2e9395b105e4149aa01e83070340c97c43
3
+ metadata.gz: 922968a144011f70f78f0e8220f5de11dd2c2abd4ed710a1d82ac9ebfe8b581d
4
+ data.tar.gz: b296b02a35e78d2997903099c22fab51154775c2930f37875e838909cd52b37f
5
5
  SHA512:
6
- metadata.gz: 9b4aa5375433d5a9196928eecddbf7d8edfcaa39161853dd84cfe51e1bf9e9bfa71e733755982ecd1014c87a52d995e34acc327911f45ce0d1fd7ea59a0e1979
7
- data.tar.gz: 2d0763db86bbaeb91027bbdad1ef3baacb01fe8ebf91e6e80051026e8700a74f44c54b9684c5e3e62c1ee7830e1b0e960645f63d5e100885e67bcda9995768b1
6
+ metadata.gz: c13b95de3a1dfe8737e7676b91f0762a88975aed761fdb7540f89d349822eb069e7f4b6859bb45b770abd18701b601c7ee2a4b3ac96b80305a796085e3f04312
7
+ data.tar.gz: f0ee7dcc857538c1fb7023660e9dd55587e27ba4c1238559586184cece0a525598adaca8ce77deb760fdb8a42a85ca87c4ca94afcdab4a9f6ae7a352cc68a406
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pirsch_api (0.0.3)
4
+ pirsch_api (0.0.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -20,67 +20,69 @@ client.valid?
20
20
  ```
21
21
 
22
22
  You will need a `Domain` as a parameter to all the following methods. This parameter could be either
23
- a `PisrchApi::Domain` instance or a simple String containing the `id` of one domain.
23
+ a `PirschApi::Domain` instance or a simple String containing the `id` of one domain.
24
24
 
25
25
  ```rb
26
26
  # Get /domains
27
27
  client.domains
28
28
  => [#<PirschApi::Domain id="0D3a...", user_id="0D3a...", hostname="pirsch.io", subdomain="pirsch", ... >]
29
- domain = c.domains.first
30
- domain.hostname
31
- => "pirsch.io"
32
- domain.id
33
- => "0D3a..."
34
- domain.to_s
35
- => "0D3a..."
29
+ domain = client.domains.first
36
30
  ```
31
+
37
32
  All the following methods receive a `domain` and an optional `filters` hash as a parameter. You can include any filter defined in the official documentation.
38
33
 
39
34
  ```rb
40
35
  # Get /statistics/visitors
41
- client.visitors(domain: domain)
36
+ client.visitors(domain: domain, filters: filters)
42
37
 
43
38
  # Get /statistics/active
44
- client.active(domain: domain)
39
+ client.active(domain: domain, filters: filters)
45
40
 
46
41
  # Get /statistics/pages
47
- client.pages(domain: domain)
42
+ client.pages(domain: domain, filters: filters)
48
43
 
49
44
  # Get /statistics/referrers
50
- client.referrers(domain: domain)
45
+ client.referrers(domain: domain, filters: filters)
51
46
 
52
47
  # Get /statistics/growth
53
- client.growth(domain: domain)
48
+ client.growth(domain: domain, filters: filters)
54
49
 
55
50
  # Get /statistics/events
56
- client.events(domain: domain)
51
+ client.events(domain: domain, filters: filters)
57
52
 
58
53
  # Get /statistics/utm/source
59
- client.utm_source(domain: domain)
54
+ client.utm_source(domain: domain, filters: filters)
60
55
 
61
56
  # Get /statistics/utm/medium
62
- client.utm_medium(domain: domain)
57
+ client.utm_medium(domain: domain, filters: filters)
63
58
 
64
59
  # Get /statistics/utm/campaign
65
- client.utm_campaign(domain: domain)
60
+ client.utm_campaign(domain: domain, filters: filters)
61
+
62
+ # Get /statistics/duration/session
63
+ client.duration_session(domain: domain, filters: filters)
64
+
65
+ # Get /statistics/duration/page
66
+ client.duration_page(domain: domain, filters: filters)
67
+
66
68
  ```
67
69
 
68
70
  ## Examples
69
71
  ```rb
70
-
71
- client.visitors(domain: d)
72
+ client.visitors(domain: domain)
72
73
  => [#<PirschApi::Visitor day="2021-08-30T00:00:00Z", visitors=87, views=200, sessions=125, bounces=53, bounce_rate=0.6091954022988506>, #<PirschApi::Visitor day="2021-08-31T00:00:00Z", visitors=77, views=159, sessions=113, bounces=49, bounce_rate=0.6363636363636364>, #<PirschApi::Visitor day="2021-09-01T00:00:00Z", visitors=76, views=161, sessions=110, bounces=48, bounce_rate=0.631578947368421>, #<PirschApi::Visitor day="2021-09-02T00:00:00Z", visitors=79, views=152, sessions=130, bounces=52, bounce_rate=0.6582278481012658>, #<PirschApi::Visitor day="2021-09-03T00:00:00Z", visitors=53, views=109, sessions=68, bounces=26, bounce_rate=0.49056603773584906>, #<PirschApi::Visitor day="2021-09-04T00:00:00Z", visitors=54, views=126, sessions=71, bounces=31, bounce_rate=0.5740740740740741>, #<PirschApi::Visitor day="2021-09-05T00:00:00Z", visitors=116, views=202, sessions=131, bounces=84, bounce_rate=0.7241379310344828>, #<PirschApi::Visitor day="2021-09-06T00:00:00Z", visitors=1, views=1, sessions=1, bounces=1, bounce_rate=1>]
73
74
 
74
- client.visitors(domain: d, filters: { from: '2021-09-01' })
75
+ client.visitors(domain: domain, filters: { from: '2021-09-01' })
75
76
  => [#<PirschApi::Visitor day="2021-09-01T00:00:00Z", visitors=76, views=161, sessions=110, bounces=48, bounce_rate=0.631578947368421>, #<PirschApi::Visitor day="2021-09-02T00:00:00Z", visitors=79, views=152, sessions=130, bounces=52, bounce_rate=0.6582278481012658>, #<PirschApi::Visitor day="2021-09-03T00:00:00Z", visitors=53, views=109, sessions=68, bounces=26, bounce_rate=0.49056603773584906>, #<PirschApi::Visitor day="2021-09-04T00:00:00Z", visitors=54, views=126, sessions=71, bounces=31, bounce_rate=0.5740740740740741>, #<PirschApi::Visitor day="2021-09-05T00:00:00Z", visitors=116, views=202, sessions=131, bounces=84, bounce_rate=0.7241379310344828>, #<PirschApi::Visitor day="2021-09-06T00:00:00Z", visitors=1, views=1, sessions=1, bounces=1, bounce_rate=1>]
76
77
 
77
- client.visitors(domain: d, filters: { from: '2021-09-01' }).first.day
78
+ client.visitors(domain: domain, filters: { from: '2021-09-01' }).first.day
78
79
  => "2021-09-01T00:00:00Z"
79
80
 
80
81
  # Get /statistics/active
81
- client.active(domain: d)
82
+ client.active(domain: domain)
82
83
  => #<PirschApi::Active stats=nil, visitors=0>
83
- client.active(domain: d).visitors
84
+
85
+ client.active(domain: domain).visitors
84
86
  => 0
85
87
  ```
86
88
 
@@ -57,5 +57,13 @@ module PirschApi
57
57
  def utm_campaign(filters: {}, domain:)
58
58
  UtmCampaignResource.new(client: self, filters: filters, domain: domain).run
59
59
  end
60
+
61
+ def duration_session(filters: {}, domain:)
62
+ DurationSessionResource.new(client: self, filters: filters, domain: domain).run
63
+ end
64
+
65
+ def duration_page(filters: {}, domain:)
66
+ DurationPageResource.new(client: self, filters: filters, domain: domain).run
67
+ end
60
68
  end
61
69
  end
@@ -0,0 +1,4 @@
1
+ module PirschApi
2
+ class DurationPage < Object
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module PirschApi
2
+ class DurationSession < Object
3
+ end
4
+ end
@@ -0,0 +1,11 @@
1
+ module PirschApi
2
+ class DurationPageResource < BaseResource
3
+ def request_url
4
+ "statistics/duration/page"
5
+ end
6
+
7
+ def parse_response(body)
8
+ JSON.parse(body).map{ |o| DurationPage.new o }
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module PirschApi
2
+ class DurationSessionResource < BaseResource
3
+ def request_url
4
+ "statistics/duration/session"
5
+ end
6
+
7
+ def parse_response(body)
8
+ JSON.parse(body).map{ |o| DurationSession.new o }
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module PirschApi
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/pirsch_api.rb CHANGED
@@ -21,6 +21,8 @@ module PirschApi
21
21
  autoload :UtmSourceResource, "pirsch_api/resources/statistics/utm_source"
22
22
  autoload :UtmCampaignResource, "pirsch_api/resources/statistics/utm_campaign"
23
23
  autoload :UtmMediumResource, "pirsch_api/resources/statistics/utm_medium"
24
+ autoload :DurationSessionResource, "pirsch_api/resources/statistics/duration_session"
25
+ autoload :DurationPageResource, "pirsch_api/resources/statistics/duration_page"
24
26
 
25
27
  autoload :Object, "pirsch_api/object"
26
28
  autoload :Token, "pirsch_api/objects/token"
@@ -34,4 +36,6 @@ module PirschApi
34
36
  autoload :UtmSource, "pirsch_api/objects/utm_source"
35
37
  autoload :UtmCampaign, "pirsch_api/objects/utm_campaign"
36
38
  autoload :UtmMedium, "pirsch_api/objects/utm_medium"
39
+ autoload :DurationSession, "pirsch_api/objects/duration_session"
40
+ autoload :DurationPage, "pirsch_api/objects/duration_page"
37
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pirsch_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gustavo Garcia
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-06 00:00:00.000000000 Z
11
+ date: 2021-09-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A very humble wrapper for the API by Pirsch.io
14
14
  email:
@@ -32,6 +32,8 @@ files:
32
32
  - lib/pirsch_api/object.rb
33
33
  - lib/pirsch_api/objects/active.rb
34
34
  - lib/pirsch_api/objects/domain.rb
35
+ - lib/pirsch_api/objects/duration_page.rb
36
+ - lib/pirsch_api/objects/duration_session.rb
35
37
  - lib/pirsch_api/objects/event.rb
36
38
  - lib/pirsch_api/objects/growth.rb
37
39
  - lib/pirsch_api/objects/page.rb
@@ -44,6 +46,8 @@ files:
44
46
  - lib/pirsch_api/resources/base.rb
45
47
  - lib/pirsch_api/resources/domain.rb
46
48
  - lib/pirsch_api/resources/statistics/active.rb
49
+ - lib/pirsch_api/resources/statistics/duration_page.rb
50
+ - lib/pirsch_api/resources/statistics/duration_session.rb
47
51
  - lib/pirsch_api/resources/statistics/event.rb
48
52
  - lib/pirsch_api/resources/statistics/growth.rb
49
53
  - lib/pirsch_api/resources/statistics/page.rb