statcounter 1.0.0 → 1.0.1

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
  SHA1:
3
- metadata.gz: b22c925b0a6e4979a589c600ce5a14a7fdac3470
4
- data.tar.gz: 6839234079b43d0ad9e5009c314c50c15507e554
3
+ metadata.gz: edd8bac52a99fb5298df25f9105b290f72acaa38
4
+ data.tar.gz: 8ac313643d7de1a06e6e75a3534e37aca4a14764
5
5
  SHA512:
6
- metadata.gz: dde7493e662532d654e4744d0808923df5d92912a17b1937f730252995226169d983026e69c64aeacf2e7c7c5e3b0c4df37e589a5b844daf790e7a0a47b503a8
7
- data.tar.gz: 8ef5c97b4f29bb6bd7378c8a11b93e9ebc48dc8c305c4fa1b239fb1e830f988d321a341622789da61d481c048f91042edc583772e3b052363013a3f198940110
6
+ metadata.gz: 851d602edc084e243c378ee58f76c7263c8ae66d133e10bcb3ead3ba7173f29feb8afc9fe54d6b6c8a22ef8d23470f23bc9d27e6da5f6f67da02d1db7c2079eb
7
+ data.tar.gz: a702c632350b053e73756e1e5ab9819e60a6abaff48f53d76032e2e9a4a222bea727203c76b164db04ce8bfe6ed3b0c1f7724ee861da25d0ac42129a9cce5a23
data/README.md CHANGED
@@ -124,6 +124,18 @@ Statcounter::Projects.create(
124
124
  }
125
125
  ```
126
126
 
127
+ #### Delete project
128
+ ```ruby
129
+ Statcounter::Projects.delete(
130
+ project_id: '123123',
131
+ admin_username: 'admin',
132
+ admin_password: 'password',
133
+ )
134
+
135
+ # return string 'ok'
136
+ 'ok'
137
+ ```
138
+
127
139
  ### Summary stats
128
140
 
129
141
  #### Get daily
@@ -26,13 +26,13 @@ module Statcounter
26
26
 
27
27
  def build_connection(credentials)
28
28
  Faraday.new(url: Statcounter::API_URL) do |c|
29
- c.adapter Faraday.default_adapter
30
29
  c.use FaradayMiddleware::FollowRedirects, limit: 3
31
30
  c.response :json, content_type: /\bjson$/
32
31
  c.response :raise_error
33
32
  c.options[:timeout] = config.timeout
34
33
  c.options[:open_timeout] = config.timeout
35
34
  c.options[:params_encoder] = Statcounter::ParamsEncoder.new(credentials)
35
+ c.adapter Faraday.default_adapter
36
36
  end
37
37
  end
38
38
 
@@ -21,5 +21,16 @@ module Statcounter
21
21
  response = Statcounter.client.get('add_project', params: params, credentials: credentials)
22
22
  response[:sc_data][0]
23
23
  end
24
+
25
+ def self.delete(project_id:, admin_username:, admin_password:, credentials: nil)
26
+ params = {
27
+ pi: project_id,
28
+ u: admin_username,
29
+ up: admin_password,
30
+ }
31
+
32
+ response = Statcounter.client.get('remove_project', params: params, credentials: credentials)
33
+ response[:@attributes][:status]
34
+ end
24
35
  end
25
36
  end
@@ -1,3 +1,3 @@
1
1
  module Statcounter
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
@@ -0,0 +1,5 @@
1
+ {
2
+ "@attributes": {
3
+ "status":"ok"
4
+ }
5
+ }
@@ -78,4 +78,24 @@ RSpec.describe Statcounter::Projects do
78
78
  expect(subject).to include(:project_id, :security_code)
79
79
  end
80
80
  end
81
+
82
+ describe '.delete' do
83
+ subject do
84
+ described_class.delete(
85
+ project_id: '1',
86
+ admin_username: 'admin',
87
+ admin_password: 'password',
88
+ credentials: default_credentials,
89
+ )
90
+ end
91
+
92
+ before do
93
+ stub_request(:get, "http://api.statcounter.com/remove_project?f=json&pi=1&t=1466614800&u=admin&up=password&vn=3&sha1=03c9dc0b4de6af379fc2da1513c4bdb7f9ed2c7d")
94
+ .to_return(body: File.read('spec/assets/remove_project.json'))
95
+ end
96
+
97
+ it 'deletes project' do
98
+ expect(subject).to eq 'ok'
99
+ end
100
+ end
81
101
  end
@@ -16,13 +16,13 @@ Gem::Specification.new do |spec|
16
16
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
17
17
  spec.require_paths = ['lib']
18
18
 
19
- spec.add_dependency 'faraday', '~> 0.9'
20
- spec.add_dependency 'faraday_middleware', '~> 0.10'
19
+ spec.add_dependency 'faraday', '0.13.1'
20
+ spec.add_dependency 'faraday_middleware', '0.12.2'
21
21
 
22
- spec.add_development_dependency 'bundler', '~> 1.11'
23
- spec.add_development_dependency 'rake', '~> 10.0'
24
- spec.add_development_dependency 'rspec', '~> 3.0'
25
- spec.add_development_dependency 'timecop', '~> 0.8.1'
26
- spec.add_development_dependency 'rack', '~> 1.6.4'
27
- spec.add_development_dependency 'webmock', '~> 2.1'
22
+ spec.add_development_dependency 'bundler', '1.16.1'
23
+ spec.add_development_dependency 'rake', '12.3.0'
24
+ spec.add_development_dependency 'rspec', '3.7.0'
25
+ spec.add_development_dependency 'timecop', '0.9.1'
26
+ spec.add_development_dependency 'rack', '2.0.3'
27
+ spec.add_development_dependency 'webmock', '3.2.1'
28
28
  end
metadata CHANGED
@@ -1,127 +1,127 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statcounter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Šarūnas Kūjalis"
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-05 00:00:00.000000000 Z
11
+ date: 2018-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: '0.9'
19
+ version: 0.13.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: '0.9'
26
+ version: 0.13.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday_middleware
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: '0.10'
33
+ version: 0.12.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: '0.10'
40
+ version: 0.12.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: '1.11'
47
+ version: 1.16.1
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: '1.11'
54
+ version: 1.16.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: 12.3.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: 12.3.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: '3.0'
75
+ version: 3.7.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: '3.0'
82
+ version: 3.7.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: timecop
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 0.8.1
89
+ version: 0.9.1
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 0.8.1
96
+ version: 0.9.1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rack
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 1.6.4
103
+ version: 2.0.3
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 1.6.4
110
+ version: 2.0.3
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: webmock
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: '2.1'
117
+ version: 3.2.1
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: '2.1'
124
+ version: 3.2.1
125
125
  description:
126
126
  email:
127
127
  - sarjalis@gmail.com
@@ -147,6 +147,7 @@ files:
147
147
  - lib/statcounter/version.rb
148
148
  - spec/assets/add_project.json
149
149
  - spec/assets/failure.json
150
+ - spec/assets/remove_project.json
150
151
  - spec/assets/select_project.json
151
152
  - spec/assets/select_project_multiple.json
152
153
  - spec/assets/summary_stats_daily.json