fastly 1.1.4 → 1.1.5

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.
@@ -16,7 +16,7 @@ class MissingApiKeyTest < Fastly::TestCase
16
16
  end
17
17
 
18
18
  def test_purging
19
- service_name = "fastly-test-service-#{get_rand}"
19
+ service_name = "fastly-test-service-#{random_string}"
20
20
  service = @fastly.create_service(:name => service_name)
21
21
 
22
22
  assert_raises Fastly::AuthRequired do
data/test/stats_test.rb CHANGED
@@ -1,14 +1,15 @@
1
1
  require 'helper'
2
2
 
3
- FROM = "2011-01-01 00:00:00"
3
+ FROM = '2011-01-01 00:00:00'
4
4
 
5
+ # Testing client components related to stats
5
6
  class StatsTest < Fastly::TestCase
6
-
7
7
  def setup
8
- opts = login_opts(:api_key).merge(:use_curb => false)
8
+ opts = login_opts(:api_key)
9
+
9
10
  begin
10
11
  @fastly = Fastly.new(opts)
11
- rescue Exception => e
12
+ rescue => e
12
13
  warn e.inspect
13
14
  warn e.backtrace.join("\n")
14
15
  exit(-1)
@@ -17,69 +18,60 @@ class StatsTest < Fastly::TestCase
17
18
 
18
19
  def test_regions
19
20
  regions = @fastly.regions
20
- assert(regions.size>0)
21
+ assert_equal true, (regions.size > 0)
21
22
  end
22
23
 
23
24
  def test_usage
24
25
  usage = @fastly.usage(:from => FROM)
25
- assert(usage["usa"], "Found a USA region in usage");
26
- assert(usage["usa"]["requests"], "USA region has a requests field");
26
+ assert(usage['usa'], 'Found a USA region in usage')
27
+ assert(usage['usa']['requests'], 'USA region has a requests field')
27
28
 
28
29
  usage = @fastly.usage(:from => FROM, :by_service => 1)
29
- assert(usage["usa"], "Found a USA region in usage");
30
- assert(usage["usa"]["requests"].nil?, "USA region doesn't have a requests field");
30
+ assert(usage['usa'], 'Found a USA region in usage')
31
+ assert(usage['usa']['requests'].nil?, "USA region doesn't have a requests field")
31
32
  end
32
33
 
33
-
34
34
  def test_stats
35
- stats = @fastly.stats(:from => $FROM)
35
+ stats = @fastly.stats(:from => FROM)
36
36
  service1, service2 = stats.keys
37
- assert(stats[service1][0]["requests"], "Found requests")
38
- assert(stats[service1][0]["hits"], "Found hits")
39
- assert(stats[service2][0]["requests"], "Found requests")
40
- assert(stats[service2][0]["hits"], "Found hits")
41
-
42
- stats = @fastly.stats(:from => $FROM, :field => "requests")
43
- assert(stats[service1][0]["requests"], "Found requests")
44
- assert(stats[service1][0]["hits"].nil?, "Didn't find hits")
45
- assert(stats[service2][0]["requests"], "Found requests")
46
- assert(stats[service2][0]["hits"].nil?, "Didn't find hits")
47
-
48
- stats = @fastly.stats(:from => $FROM, :service => service1)
49
- assert_equal(stats[0]["service_id"], service1, "Got correct service id")
50
- assert(stats[0]["requests"], "Found requests")
51
- assert(stats[0]["hits"], "Found hits")
52
-
53
- stats = @fastly.stats(:from => $FROM, :field => "requests", :service => service1)
54
- assert_equal(stats[0]["service_id"], service1, "Got correct service id")
55
- assert(stats[0]["requests"], "Found requests")
56
- assert(stats[0]["hits"].nil?, "Didn't find hits")
37
+ assert(stats[service1][0]['requests'], 'Found requests')
38
+ assert(stats[service1][0]['hits'], 'Found hits')
39
+ assert(stats[service2][0]['requests'], 'Found requests')
40
+ assert(stats[service2][0]['hits'], 'Found hits')
41
+
42
+ stats = @fastly.stats(:from => FROM, :field => 'requests')
43
+ assert(stats[service1][0]['requests'], 'Found requests')
44
+ assert(stats[service1][0]['hits'].nil?, "Didn't find hits")
45
+ assert(stats[service2][0]['requests'], 'Found requests')
46
+ assert(stats[service2][0]['hits'].nil?, "Didn't find hits")
47
+
48
+ stats = @fastly.stats(:from => FROM, :service => service1)
49
+ assert_equal(stats[0]['service_id'], service1, 'Got correct service id')
50
+ assert(stats[0]['requests'], 'Found requests')
51
+ assert(stats[0]['hits'], 'Found hits')
52
+
53
+ stats = @fastly.stats(:from => FROM, :field => 'requests', :service => service1)
54
+ assert_equal(stats[0]['service_id'], service1, 'Got correct service id')
55
+ assert(stats[0]['requests'], 'Found requests')
56
+ assert(stats[0]['hits'].nil?, "Didn't find hits")
57
+
58
+ stats = @fastly.stats(:from => FROM, :aggregate => true)
59
+ assert(stats[0]['service_id'].nil?, 'No service id')
60
+ assert(stats[0]['requests'], 'Found requests')
61
+ assert(stats[0]['hits'], 'Found hits')
57
62
 
58
- stats = @fastly.stats(:from => $FROM, :aggregate => true)
59
- assert(stats[0]["service_id"].nil?, "No service id")
60
- assert(stats[0]["requests"], "Found requests")
61
- assert(stats[0]["hits"], "Found hits")
62
-
63
- stats = nil
64
63
  # stats aggregate with field
65
- begin
66
- stats = @fastly.stats(:from => $FROM, :field => "requests", :aggregate => true)
67
- rescue Fastly::Error => e
64
+ assert_raises Fastly::Error do
65
+ @fastly.stats(:from => FROM, :field => 'requests', :aggregate => true)
68
66
  end
69
- assert stats.nil?
70
67
 
71
68
  # stats aggregate with service
72
- begin
73
- stats = @fastly.stats(:from => $FROM, :service => service1, :aggregate => true)
74
- rescue Fastly::Error => e
69
+ assert_raises Fastly::Error do
70
+ @fastly.stats(:from => FROM, :service => service1, :aggregate => true)
75
71
  end
76
- assert stats.nil?
77
72
 
78
- begin
79
- stats = @fastly.stats(:from => $FROM, :service => service1, :field => "requests", :aggregate => true)
80
- rescue Fastly::Error => e
73
+ assert_raises Fastly::Error do
74
+ @fastly.stats(:from => FROM, :service => service1, :field => 'requests', :aggregate => true)
81
75
  end
82
- assert stats.nil?
83
76
  end
84
-
85
77
  end
metadata CHANGED
@@ -1,46 +1,48 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastly
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
- - Fastly Inc
7
+ - Fastly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-29 00:00:00.000000000 Z
11
+ date: 2014-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curb
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 0.7.15
19
+ version: 0.8.6
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.7.15
26
+ version: 0.8.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: curb-fu
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 0.6.1
33
+ version: 0.6.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.6.1
40
+ version: 0.6.2
41
41
  description: Client library for the Fastly acceleration system
42
42
  email:
43
- - support@fastly.com
43
+ - simon@fastly.com
44
+ - zeke@templ.in
45
+ - tyler@fastly.com
44
46
  executables:
45
47
  - fastly_create_domain
46
48
  - fastly_upload_vcl
@@ -58,12 +60,14 @@ files:
58
60
  - bin/fastly_create_domain
59
61
  - bin/fastly_upload_vcl
60
62
  - fastly.gemspec
63
+ - lib/ext/curb_fu/response/base.rb
61
64
  - lib/fastly.rb
62
65
  - lib/fastly/backend.rb
63
66
  - lib/fastly/base.rb
64
67
  - lib/fastly/belongs_to_service_and_version.rb
65
68
  - lib/fastly/cache_setting.rb
66
69
  - lib/fastly/client.rb
70
+ - lib/fastly/client/curl.rb
67
71
  - lib/fastly/condition.rb
68
72
  - lib/fastly/customer.rb
69
73
  - lib/fastly/director.rb
@@ -115,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
119
  version: '0'
116
120
  requirements: []
117
121
  rubyforge_project:
118
- rubygems_version: 2.0.14
122
+ rubygems_version: 2.4.4
119
123
  signing_key:
120
124
  specification_version: 4
121
125
  summary: Client library for the Fastly acceleration system