fastly 1.1.1 → 1.1.2

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: 7185290c285aff8cefd7d9285f43f3e245051e2d
4
- data.tar.gz: 70e9c38148ce099176ae05fc712a0b046b542e47
3
+ metadata.gz: 1ef96a7f613dfa4a86cf2312c52bce16235bf7cf
4
+ data.tar.gz: 4d5b36b94d9d90f263f3f831dc72cfb333d88813
5
5
  SHA512:
6
- metadata.gz: 75e37814b6bc25c1317086e90ad0743298d6680597bb78f1dcc13497baa698a950b560f7a67b3b5d062797cc71712b269554c371685a626e523eccf27cf6b6c9
7
- data.tar.gz: c01bcc6cca3b593c849a2bce956f3fe90741fead91100cadd8d2011baab80a78e32f8d092cddf27d75cf8ea4576e0dbadd65eaed7ecae06165baef490599ab1c
6
+ metadata.gz: 128bb682ee2ed4be291c9eb7d0bbf420e88d4c2f33c139dd606696bc80aefd74638040a3d77b034cefa3f8ba0e6d4f003be5e5f627762b88f4f4f5ffd8e6038b
7
+ data.tar.gz: a3bfafd5d8517237b3f0a452d2bb4397d3f57a6685c7cad38a57b582730e898d758ee49d5106b7c76431937b986f7f9a16adb1d30e085f76f4897713e6cb7a16
data/Gemfile CHANGED
@@ -6,4 +6,5 @@ group :development, :test do
6
6
  gem 'rake', '~> 10.3.2'
7
7
  gem 'rdoc', '~> 4.1.1'
8
8
  gem 'minitest', '~> 5.3.4'
9
+ gem 'pry'
9
10
  end
@@ -1,3 +1,10 @@
1
+ # 2014-06-12 v1.1.2
2
+ * Replace `String#underscore` with `Fastly::Util.class_to_path` method.
3
+ * Add first true unit test
4
+ * Add `test_helper.rb`
5
+ * Add `pry` as dependency
6
+ * Add console Rake task
7
+
1
8
  2013-11-26 v1.02
2
9
 
3
10
  Fix rdoc dependency and quorum spelling (Kristoffer Renholm)
data/Rakefile CHANGED
@@ -2,6 +2,14 @@ require 'bundler/gem_tasks'
2
2
  require 'rake/testtask'
3
3
  require 'rdoc/task'
4
4
 
5
+ desc 'Run library from within a Pry console'
6
+ task :console do
7
+ require 'pry'
8
+ require 'fastly'
9
+ ARGV.clear
10
+ Pry.start
11
+ end
12
+
5
13
  RDoc::Task.new do |rdoc|
6
14
  rdoc.rdoc_dir = 'doc'
7
15
  rdoc.main = 'README.md'
@@ -5,7 +5,7 @@
5
5
  # A client library for interacting with the Fastly web acceleration service
6
6
  class Fastly
7
7
  require 'fastly/gem_version'
8
- require 'fastly/string'
8
+ require 'fastly/util'
9
9
  require 'fastly/fetcher'
10
10
  require 'fastly/client'
11
11
 
@@ -155,7 +155,7 @@ class Fastly
155
155
  end
156
156
 
157
157
  [User, Customer, Backend, CacheSetting, Condition, Director, Domain, Header, Healthcheck, Gzip, Match, Origin, RequestSetting, ResponseObject, Service, S3Logging, Syslog, VCL, Version].each do |klass|
158
- type = klass.to_s.split("::")[-1].underscore
158
+ type = Util.class_to_path(klass)
159
159
  # unless the class doesn't have a list path or it already exists
160
160
  unless klass.list_path.nil? || klass.respond_to?("list_#{type}s".to_sym)
161
161
  self.send :define_method, "list_#{type}s".to_sym do |*args|
@@ -1,4 +1,3 @@
1
-
2
1
  class Fastly
3
2
  # Base class for all Fastly objects
4
3
  class Base # :nodoc: all
@@ -35,7 +34,7 @@ class Fastly
35
34
  end
36
35
 
37
36
  def self.path
38
- self.to_s.split("::")[-1].underscore
37
+ Util.class_to_path(self)
39
38
  end
40
39
 
41
40
  def self.get_path(id)
@@ -41,7 +41,7 @@ class Fastly
41
41
  private
42
42
  # needs an 's' at the end of the url
43
43
  def self.path
44
- self.to_s.split("::")[-1].underscore + "s"
44
+ Util.class_to_path(self, true)
45
45
  end
46
46
  end
47
47
  end
@@ -1,4 +1,4 @@
1
1
  class Fastly
2
2
  # The current version of the library
3
- VERSION = "1.1.1"
3
+ VERSION = "1.1.2"
4
4
  end
@@ -84,7 +84,7 @@ class Fastly
84
84
 
85
85
  private
86
86
  def self.path
87
- self.to_s.split("::")[-1].underscore + "s"
87
+ Util.class_to_path(self, true)
88
88
  end
89
89
  end
90
90
  end
@@ -0,0 +1,9 @@
1
+ class Fastly
2
+ module Util
3
+ def self.class_to_path(klass, append_s = false)
4
+ klass_string = klass.to_s.split('::')[-1]
5
+ klass_string = klass_string.gsub(/([^A-Z])([A-Z]+)/, '\1_\2').downcase
6
+ append_s ? "#{klass_string}s" : klass_string
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,20 @@
1
+ require 'test_helper'
2
+
3
+ class Fastly
4
+ class FooBar; end
5
+ class FooBarBaz; end
6
+ describe Util do
7
+ describe '.class_to_path' do
8
+ let(:klass) { Fastly::FooBar }
9
+ let(:klass_with_s) { Fastly::FooBarBaz }
10
+
11
+ it 'should convert a class name to an underscored path' do
12
+ assert_equal 'foo_bar', Util.class_to_path(klass)
13
+ end
14
+
15
+ it 'should append an s if second argument is true' do
16
+ assert_equal 'foo_bar_bazs', Util.class_to_path(klass_with_s, true)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,2 @@
1
+ require 'minitest/autorun'
2
+ require 'fastly'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastly
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fastly Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-05 00:00:00.000000000 Z
11
+ date: 2014-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curb
@@ -48,8 +48,8 @@ extra_rdoc_files: []
48
48
  files:
49
49
  - ".gitignore"
50
50
  - ".travis.yml"
51
- - Changes
52
51
  - Gemfile
52
+ - HISTORY.md
53
53
  - LICENSE
54
54
  - README.md
55
55
  - Rakefile
@@ -78,17 +78,19 @@ files:
78
78
  - lib/fastly/s3_logging.rb
79
79
  - lib/fastly/service.rb
80
80
  - lib/fastly/settings.rb
81
- - lib/fastly/string.rb
82
81
  - lib/fastly/syslog.rb
83
82
  - lib/fastly/user.rb
83
+ - lib/fastly/util.rb
84
84
  - lib/fastly/vcl.rb
85
85
  - lib/fastly/version.rb
86
86
  - test/admin_test.rb
87
87
  - test/api_key_test.rb
88
88
  - test/common.rb
89
+ - test/fastly/util_test.rb
89
90
  - test/full_login_test.rb
90
91
  - test/helper.rb
91
92
  - test/stats_test.rb
93
+ - test/test_helper.rb
92
94
  homepage: http://github.com/fastly/fastly-ruby
93
95
  licenses:
94
96
  - MIT
@@ -117,6 +119,8 @@ test_files:
117
119
  - test/admin_test.rb
118
120
  - test/api_key_test.rb
119
121
  - test/common.rb
122
+ - test/fastly/util_test.rb
120
123
  - test/full_login_test.rb
121
124
  - test/helper.rb
122
125
  - test/stats_test.rb
126
+ - test/test_helper.rb
@@ -1,7 +0,0 @@
1
- # add an underscore method to String, so we can easily convert CamelCase to
2
- # camel_case for CacheSetting and RequestSetting objects.
3
- class String
4
- def underscore
5
- gsub(/([^A-Z])([A-Z]+)/, '\1_\2').downcase
6
- end
7
- end