shushu 0.1.13 → 0.1.14
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.
- data/lib/models/report.rb +18 -1
- data/lib/shushu.rb +1 -1
- data/readme.md +16 -10
- metadata +5 -5
data/lib/models/report.rb
CHANGED
@@ -7,8 +7,12 @@ module Shushu
|
|
7
7
|
)
|
8
8
|
|
9
9
|
def fetch
|
10
|
+
url = [Shushu.url, resource].join
|
10
11
|
Shushu.handle_req do
|
11
|
-
RestClient.get(
|
12
|
+
RestClient.get(url, {:params => {
|
13
|
+
:from => from.utc.to_s,
|
14
|
+
:to => to.utc.to_s
|
15
|
+
}})
|
12
16
|
end
|
13
17
|
end
|
14
18
|
|
@@ -48,4 +52,17 @@ module Shushu
|
|
48
52
|
"/payment_methods/#{payment_method_id}/invoices"
|
49
53
|
end
|
50
54
|
end
|
55
|
+
|
56
|
+
class RateCodeReport < Report
|
57
|
+
attr_accessor :rate_code_id
|
58
|
+
|
59
|
+
def initialize(rate_code_id, from, to)
|
60
|
+
@rate_code_id, @from, @to = rate_code_id, from, to
|
61
|
+
end
|
62
|
+
|
63
|
+
def resource
|
64
|
+
"/rate_codes/#{rate_code_id}/report"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
51
68
|
end
|
data/lib/shushu.rb
CHANGED
data/readme.md
CHANGED
@@ -218,14 +218,20 @@ Shushu::BEvent.open(
|
|
218
218
|
Don't forget to close it.
|
219
219
|
|
220
220
|
```ruby
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
221
|
+
Shushu::BEvent.close(
|
222
|
+
:entity_id => entity_id,
|
223
|
+
:hid => hid,
|
224
|
+
:rate_code => rate_code,
|
225
|
+
:time => time
|
226
|
+
)
|
227
227
|
```
|
228
228
|
|
229
|
+
### Invoice
|
230
|
+
|
231
|
+
```ruby
|
232
|
+
invoice = Shushu::Invoice.new(payment_method_id, from, to)
|
233
|
+
invoice.billable_units
|
234
|
+
```
|
229
235
|
### UsageReport
|
230
236
|
|
231
237
|
```ruby
|
@@ -233,11 +239,12 @@ report = Shushu::UsageReport.new(account_id, from, to)
|
|
233
239
|
report.billable_units
|
234
240
|
```
|
235
241
|
|
236
|
-
###
|
242
|
+
### RateCodeReport
|
237
243
|
|
238
244
|
```ruby
|
239
|
-
|
240
|
-
|
245
|
+
report = Shushu::RateCodeReport.new(rate_code_id, from, to)
|
246
|
+
report.total
|
247
|
+
report.billable_units
|
241
248
|
```
|
242
249
|
|
243
250
|
|
@@ -258,7 +265,6 @@ retreived from the remote API.
|
|
258
265
|
|
259
266
|
Report --> LineItem --> UnitGroup --> Billable Unit
|
260
267
|
|
261
|
-
|
262
268
|
#### ReportPresenter
|
263
269
|
|
264
270
|
The report presenter is how you will kick off the process of generating a
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shushu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-12-29 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
16
|
-
requirement: &
|
16
|
+
requirement: &10447360 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *10447360
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: yajl-ruby
|
27
|
-
requirement: &
|
27
|
+
requirement: &10446420 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 1.1.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *10446420
|
36
36
|
description: A ruby wrapper around Shushu's HTTP API.
|
37
37
|
email: ryan@heroku.com
|
38
38
|
executables: []
|