plausible_api 0.1.8 → 0.1.10
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/Gemfile.lock +2 -2
 - data/lib/plausible_api/stats/aggregate.rb +2 -2
 - data/lib/plausible_api/stats/base.rb +9 -9
 - data/lib/plausible_api/version.rb +1 -1
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 5fcd7e3adaeb1c8fb8dc1de67e305573708d04e971e995bcffeb4d0fe71ec8ff
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: b729b5a5de1b5f6572c175879e77daed92aba1cc60075033b1e693752e13b7ce
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 0d0757ae94943225433757648bc542dd2afa2a1706696b35cdb179f7f117cb8a8b34581ea0bc7a50ac1d8973c137206bf520e2b6d27129d06c7ff310ca757d6e
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: db68b71615cb9026ae5a9dddaa1fee92c51740d0314f556e032cd0975ea71675fbade8733e80c1b4975e53d64d7f1347747b10cb1a73b8f5c034d29b3f396590
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
| 
         @@ -6,7 +6,7 @@ module PlausibleApi 
     | 
|
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                  def initialize(options = {})
         
     | 
| 
       8 
8 
     | 
    
         
             
                    super({ period: '30d', 
         
     | 
| 
       9 
     | 
    
         
            -
                            metrics: 'visitors,pageviews,bounce_rate,visit_duration' }
         
     | 
| 
      
 9 
     | 
    
         
            +
                            metrics: 'visitors,visits,pageviews,views_per_visit,bounce_rate,visit_duration,events' }
         
     | 
| 
       10 
10 
     | 
    
         
             
                          .merge(options))
         
     | 
| 
       11 
11 
     | 
    
         
             
                  end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
         @@ -19,4 +19,4 @@ module PlausibleApi 
     | 
|
| 
       19 
19 
     | 
    
         
             
                  end
         
     | 
| 
       20 
20 
     | 
    
         
             
                end
         
     | 
| 
       21 
21 
     | 
    
         
             
              end
         
     | 
| 
       22 
     | 
    
         
            -
            end
         
     | 
| 
      
 22 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -6,7 +6,7 @@ module PlausibleApi 
     | 
|
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                  def initialize(options = {})
         
     | 
| 
       8 
8 
     | 
    
         
             
                    @options = { compare: nil, date: nil, filters: nil, interval: nil,
         
     | 
| 
       9 
     | 
    
         
            -
                                  limit: nil, metrics: nil, page: nil, period: nil, 
     | 
| 
      
 9 
     | 
    
         
            +
                                  limit: nil, metrics: nil, page: nil, period: nil,
         
     | 
| 
       10 
10 
     | 
    
         
             
                                  property: nil }.merge(options)
         
     | 
| 
       11 
11 
     | 
    
         
             
                    @options[:period] = 'custom' if @options[:date]
         
     | 
| 
       12 
12 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -28,22 +28,22 @@ module PlausibleApi 
     | 
|
| 
       28 
28 
     | 
    
         
             
                    errors.empty?
         
     | 
| 
       29 
29 
     | 
    
         
             
                  end
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
                  def errors 
     | 
| 
      
 31 
     | 
    
         
            +
                  def errors
         
     | 
| 
       32 
32 
     | 
    
         
             
                    allowed_period   = %w(12mo 6mo month 30d 7d day custom)
         
     | 
| 
       33 
     | 
    
         
            -
                    allowed_metrics  = %w(visitors pageviews bounce_rate visit_duration)
         
     | 
| 
      
 33 
     | 
    
         
            +
                    allowed_metrics  = %w(visitors visits pageviews views_per_visit bounce_rate visit_duration events)
         
     | 
| 
       34 
34 
     | 
    
         
             
                    allowed_compare  = %w(previous_period)
         
     | 
| 
       35 
35 
     | 
    
         
             
                    allowed_interval = %w(date month)
         
     | 
| 
       36 
     | 
    
         
            -
                    allowed_property = %w(event:page visit: 
     | 
| 
       37 
     | 
    
         
            -
                      visit:utm_source visit:utm_campaign visit:device visit:browser 
     | 
| 
       38 
     | 
    
         
            -
                      visit:os visit:os_version visit:country)
         
     | 
| 
      
 36 
     | 
    
         
            +
                    allowed_property = %w(event:page visit:entry_page visit:exit_page visit:source visit:referrer
         
     | 
| 
      
 37 
     | 
    
         
            +
                      visit:utm_medium visit:utm_source visit:utm_campaign visit:device visit:browser
         
     | 
| 
      
 38 
     | 
    
         
            +
                      visit:browser_version visit:os visit:os_version visit:country)
         
     | 
| 
       39 
39 
     | 
    
         
             
                    e = 'Not a valid parameter. Allowed parameters are: '
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
       41 
41 
     | 
    
         
             
                    errors = []
         
     | 
| 
       42 
42 
     | 
    
         
             
                    if @options[:period]
         
     | 
| 
       43 
43 
     | 
    
         
             
                      errors.push({ period: "#{e}#{allowed_period.join(', ')}" }) unless allowed_period.include? @options[:period]
         
     | 
| 
       44 
44 
     | 
    
         
             
                    end
         
     | 
| 
       45 
45 
     | 
    
         
             
                    if @options[:metrics]
         
     | 
| 
       46 
     | 
    
         
            -
                      metrics_array = @options[:metrics].split(',') 
     | 
| 
      
 46 
     | 
    
         
            +
                      metrics_array = @options[:metrics].split(',')
         
     | 
| 
       47 
47 
     | 
    
         
             
                      errors.push({ metrics: "#{e}#{allowed_metrics.join(', ')}" }) unless metrics_array & allowed_metrics == metrics_array
         
     | 
| 
       48 
48 
     | 
    
         
             
                    end
         
     | 
| 
       49 
49 
     | 
    
         
             
                    if @options[:compare]
         
     | 
| 
         @@ -81,4 +81,4 @@ module PlausibleApi 
     | 
|
| 
       81 
81 
     | 
    
         
             
                  end
         
     | 
| 
       82 
82 
     | 
    
         
             
                end
         
     | 
| 
       83 
83 
     | 
    
         
             
              end
         
     | 
| 
       84 
     | 
    
         
            -
            end
         
     | 
| 
      
 84 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: plausible_api
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.10
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Gustavo Garcia
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-07-14 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       13 
13 
     | 
    
         
             
            description: A very humble wrapper for the new API by Plausible
         
     | 
| 
       14 
14 
     | 
    
         
             
            email:
         
     | 
| 
         @@ -57,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       57 
57 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       58 
58 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       59 
59 
     | 
    
         
             
            requirements: []
         
     | 
| 
       60 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
      
 60 
     | 
    
         
            +
            rubygems_version: 3.3.7
         
     | 
| 
       61 
61 
     | 
    
         
             
            signing_key:
         
     | 
| 
       62 
62 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       63 
63 
     | 
    
         
             
            summary: A simple Plausible API wrapper for Rails
         
     |