fastly 1.14.0 → 1.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +87 -0
- data/lib/fastly.rb +3 -0
- data/lib/fastly/gem_version.rb +1 -1
- data/lib/fastly/invoice.rb +33 -22
- data/test/stats_test.rb +5 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3b7bdc72892cb3e1431e698bdd1d2e4fe61e903c1a02047c1854dbeb89261d8b
|
4
|
+
data.tar.gz: 55678cb45fa20bb7787088651d42f859a852d413d83a45c7e41aa979fa323caf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cc79fa5482c9b65f40605454b5aafc013c40b37a5a03898878165dff5f31b2afc533dded11d4d94fbfbce3e02fbde7ce49ba65edb9f1f5a4eaaf2cba8ad575e
|
7
|
+
data.tar.gz: bb8fee497d3479d46d4ab588967257f0442f8c259fed6e727eb0507f377ee84bd46b6360d9583e35a370b8c56fb6c586ef1e8c7ce63017ec8643314365b81b26
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,92 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v1.15.0](https://github.com/fastly/fastly-ruby/tree/v1.15.0) (2018-04-04)
|
4
|
+
[Full Changelog](https://github.com/fastly/fastly-ruby/compare/v1.14.0...v1.15.0)
|
5
|
+
|
6
|
+
**Merged pull requests:**
|
7
|
+
|
8
|
+
- Feature - add support for /stats/usage\_by\_month [\#124](https://github.com/fastly/fastly-ruby/pull/124) ([jrbeilke](https://github.com/jrbeilke))
|
9
|
+
- add changelog for v1.14.0 [\#123](https://github.com/fastly/fastly-ruby/pull/123) ([thommahoney](https://github.com/thommahoney))
|
10
|
+
|
11
|
+
## [v1.14.0](https://github.com/fastly/fastly-ruby/tree/v1.14.0) (2018-03-23)
|
12
|
+
[Full Changelog](https://github.com/fastly/fastly-ruby/compare/v1.13.2...v1.14.0)
|
13
|
+
|
14
|
+
**Merged pull requests:**
|
15
|
+
|
16
|
+
- bump to v1.14.0 [\#122](https://github.com/fastly/fastly-ruby/pull/122) ([thommahoney](https://github.com/thommahoney))
|
17
|
+
- Placement in Syslog [\#121](https://github.com/fastly/fastly-ruby/pull/121) ([RexBelli](https://github.com/RexBelli))
|
18
|
+
|
19
|
+
## [v1.13.2](https://github.com/fastly/fastly-ruby/tree/v1.13.2) (2017-12-18)
|
20
|
+
[Full Changelog](https://github.com/fastly/fastly-ruby/compare/v1.13.1...v1.13.2)
|
21
|
+
|
22
|
+
**Merged pull requests:**
|
23
|
+
|
24
|
+
- Fix syslog response\_condition attribute [\#117](https://github.com/fastly/fastly-ruby/pull/117) ([anotherJay](https://github.com/anotherJay))
|
25
|
+
|
26
|
+
## [v1.13.1](https://github.com/fastly/fastly-ruby/tree/v1.13.1) (2017-08-08)
|
27
|
+
[Full Changelog](https://github.com/fastly/fastly-ruby/compare/v1.13.0...v1.13.1)
|
28
|
+
|
29
|
+
**Merged pull requests:**
|
30
|
+
|
31
|
+
- automatically load the sumologic\_logging class [\#115](https://github.com/fastly/fastly-ruby/pull/115) ([thommahoney](https://github.com/thommahoney))
|
32
|
+
|
33
|
+
## [v1.13.0](https://github.com/fastly/fastly-ruby/tree/v1.13.0) (2017-08-07)
|
34
|
+
[Full Changelog](https://github.com/fastly/fastly-ruby/compare/v1.12.0...v1.13.0)
|
35
|
+
|
36
|
+
**Merged pull requests:**
|
37
|
+
|
38
|
+
- add support for sumologic [\#114](https://github.com/fastly/fastly-ruby/pull/114) ([thommahoney](https://github.com/thommahoney))
|
39
|
+
|
40
|
+
## [v1.12.0](https://github.com/fastly/fastly-ruby/tree/v1.12.0) (2017-08-03)
|
41
|
+
[Full Changelog](https://github.com/fastly/fastly-ruby/compare/v1.11.0...v1.12.0)
|
42
|
+
|
43
|
+
**Merged pull requests:**
|
44
|
+
|
45
|
+
- add support for dynamic snippets [\#113](https://github.com/fastly/fastly-ruby/pull/113) ([thommahoney](https://github.com/thommahoney))
|
46
|
+
- Added VCL snippets endpoint [\#112](https://github.com/fastly/fastly-ruby/pull/112) ([thomshutt](https://github.com/thomshutt))
|
47
|
+
|
48
|
+
## [v1.11.0](https://github.com/fastly/fastly-ruby/tree/v1.11.0) (2017-06-12)
|
49
|
+
[Full Changelog](https://github.com/fastly/fastly-ruby/compare/v1.10.0...v1.11.0)
|
50
|
+
|
51
|
+
**Merged pull requests:**
|
52
|
+
|
53
|
+
- add GCS Logging object [\#111](https://github.com/fastly/fastly-ruby/pull/111) ([thommahoney](https://github.com/thommahoney))
|
54
|
+
|
55
|
+
## [v1.10.0](https://github.com/fastly/fastly-ruby/tree/v1.10.0) (2017-03-17)
|
56
|
+
[Full Changelog](https://github.com/fastly/fastly-ruby/compare/v1.9.0...v1.10.0)
|
57
|
+
|
58
|
+
**Merged pull requests:**
|
59
|
+
|
60
|
+
- Support Papertrail logging endpoints [\#110](https://github.com/fastly/fastly-ruby/pull/110) ([werkshy](https://github.com/werkshy))
|
61
|
+
|
62
|
+
## [v1.9.0](https://github.com/fastly/fastly-ruby/tree/v1.9.0) (2017-02-03)
|
63
|
+
[Full Changelog](https://github.com/fastly/fastly-ruby/compare/v1.8.0...v1.9.0)
|
64
|
+
|
65
|
+
**Closed issues:**
|
66
|
+
|
67
|
+
- Missing tag for v1.8.0 [\#108](https://github.com/fastly/fastly-ruby/issues/108)
|
68
|
+
|
69
|
+
**Merged pull requests:**
|
70
|
+
|
71
|
+
- Add `message\_type` support to logging resources [\#109](https://github.com/fastly/fastly-ruby/pull/109) ([schisamo](https://github.com/schisamo))
|
72
|
+
|
73
|
+
## [v1.8.0](https://github.com/fastly/fastly-ruby/tree/v1.8.0) (2017-01-17)
|
74
|
+
[Full Changelog](https://github.com/fastly/fastly-ruby/compare/v1.7.0...v1.8.0)
|
75
|
+
|
76
|
+
**Merged pull requests:**
|
77
|
+
|
78
|
+
- Support for HTTP debug logs [\#107](https://github.com/fastly/fastly-ruby/pull/107) ([thommahoney](https://github.com/thommahoney))
|
79
|
+
- use public\_suffix version 1.4.6 for ruby 1.9 [\#105](https://github.com/fastly/fastly-ruby/pull/105) ([thommahoney](https://github.com/thommahoney))
|
80
|
+
- Enable HTTP proxy support from environment [\#104](https://github.com/fastly/fastly-ruby/pull/104) ([vr](https://github.com/vr))
|
81
|
+
|
82
|
+
## [v1.7.0](https://github.com/fastly/fastly-ruby/tree/v1.7.0) (2016-10-24)
|
83
|
+
[Full Changelog](https://github.com/fastly/fastly-ruby/compare/v1.6.1...v1.7.0)
|
84
|
+
|
85
|
+
**Merged pull requests:**
|
86
|
+
|
87
|
+
- Add ACL and ACL Entry Support [\#103](https://github.com/fastly/fastly-ruby/pull/103) ([wrightp](https://github.com/wrightp))
|
88
|
+
- add https support to purge function [\#99](https://github.com/fastly/fastly-ruby/pull/99) ([jgoulah](https://github.com/jgoulah))
|
89
|
+
|
3
90
|
## [v1.6.1](https://github.com/fastly/fastly-ruby/tree/v1.6.1) (2016-09-06)
|
4
91
|
[Full Changelog](https://github.com/fastly/fastly-ruby/compare/v1.6.0...v1.6.1)
|
5
92
|
|
data/lib/fastly.rb
CHANGED
@@ -128,6 +128,8 @@ class Fastly
|
|
128
128
|
|
129
129
|
# Returns usage information aggregated across all Fastly services and grouped by region.
|
130
130
|
#
|
131
|
+
# If the :by_month flag is passed then returns total usage information aggregated by month as well as grouped by service & region.
|
132
|
+
#
|
131
133
|
# If the :by_service flag is passed then returns usage information aggregated by service and grouped by service & region.
|
132
134
|
#
|
133
135
|
# Other options available are:
|
@@ -140,6 +142,7 @@ class Fastly
|
|
140
142
|
# See http://docs.fastly.com/docs/stats for details.
|
141
143
|
def usage(opts)
|
142
144
|
url = '/stats/usage'
|
145
|
+
url += '_by_month' if opts.delete(:by_month)
|
143
146
|
url += '_by_service' if opts.delete(:by_service)
|
144
147
|
client.get_stats(url, opts)
|
145
148
|
end
|
data/lib/fastly/gem_version.rb
CHANGED
data/lib/fastly/invoice.rb
CHANGED
@@ -4,19 +4,7 @@ require 'date'
|
|
4
4
|
class Fastly
|
5
5
|
# An invoice for a time period
|
6
6
|
class Invoice < Base
|
7
|
-
attr_accessor :
|
8
|
-
|
9
|
-
##
|
10
|
-
# :attr: service_id
|
11
|
-
#
|
12
|
-
# The id of the service this invoice is for
|
13
|
-
#
|
14
|
-
|
15
|
-
##
|
16
|
-
# :attr: service_name
|
17
|
-
#
|
18
|
-
# The id of the service this invoice is for
|
19
|
-
#
|
7
|
+
attr_accessor :start_time, :end_time, :invoice_id, :total, :regions
|
20
8
|
|
21
9
|
##
|
22
10
|
# :attr: start_time
|
@@ -56,13 +44,17 @@ class Fastly
|
|
56
44
|
def self.get_path(*args)
|
57
45
|
opts = args.size > 0 ? args[0] : {}
|
58
46
|
|
59
|
-
url = '/billing'
|
47
|
+
url = '/billing/v2'
|
60
48
|
|
61
|
-
url +=
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
49
|
+
url += if opts.key?(:year) && opts.key?(:month)
|
50
|
+
"/year/#{opts[:year]}/month/#{opts[:month]}"
|
51
|
+
elsif opts.key?(:id)
|
52
|
+
"/account_customers/#{opts[:customer_id]}/invoices/#{opts[:id]}"
|
53
|
+
elsif opts.key?(:mtd)
|
54
|
+
"/account_customers/#{opts[:customer_id]}/mtd_invoice"
|
55
|
+
else
|
56
|
+
"/account_customers/#{opts[:customer_id]}/invoices"
|
57
|
+
end
|
66
58
|
|
67
59
|
url
|
68
60
|
end
|
@@ -92,18 +84,37 @@ class Fastly
|
|
92
84
|
end
|
93
85
|
end
|
94
86
|
|
95
|
-
# Return an
|
87
|
+
# Return an Invoice object
|
96
88
|
#
|
97
89
|
# If a year and month are passed in returns the invoices for that whole month.
|
98
90
|
#
|
99
91
|
# Otherwise it returns the invoices for the current month so far.
|
100
92
|
def get_invoice(year = nil, month = nil)
|
101
|
-
opts = {}
|
102
|
-
|
93
|
+
opts = { customer_id: current_customer.id }
|
94
|
+
if year.nil? || month.nil?
|
95
|
+
opts[:mtd] = true
|
96
|
+
else
|
103
97
|
opts[:year] = year
|
104
98
|
opts[:month] = month
|
105
99
|
end
|
106
100
|
|
107
101
|
get(Invoice, opts)
|
108
102
|
end
|
103
|
+
|
104
|
+
# Return an Invoice object for the passed invoice ID
|
105
|
+
def get_invoice_by_id(id)
|
106
|
+
opts = {
|
107
|
+
id: id,
|
108
|
+
customer_id: current_customer.id
|
109
|
+
}
|
110
|
+
|
111
|
+
get(Invoice, opts)
|
112
|
+
end
|
113
|
+
|
114
|
+
# Retun an array of Invoice objects.
|
115
|
+
def list_invoices
|
116
|
+
opts = { customer_id: current_customer.id }
|
117
|
+
|
118
|
+
list(Invoice, opts)
|
119
|
+
end
|
109
120
|
end
|
data/test/stats_test.rb
CHANGED
@@ -30,6 +30,11 @@ class StatsTest < Fastly::TestCase
|
|
30
30
|
assert(usage['meta'])
|
31
31
|
assert_equal 'success', usage['status']
|
32
32
|
|
33
|
+
usage = @fastly.usage(:from => FROM, :by_month => 1)
|
34
|
+
assert(usage)
|
35
|
+
assert(usage['meta'])
|
36
|
+
assert_equal 'success', usage['status']
|
37
|
+
|
33
38
|
usage = @fastly.usage(:from => FROM, :by_service => 1)
|
34
39
|
assert(usage)
|
35
40
|
assert(usage['meta'])
|
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.
|
4
|
+
version: 1.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fastly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Client library for the Fastly acceleration system
|
14
14
|
email:
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.
|
108
|
+
rubygems_version: 2.7.3
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: Client library for the Fastly acceleration system
|