bill_forward 1.2015.321.1 → 1.2016.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -7
- data/lib/bill_forward/entities/credit_note.rb +36 -0
- data/lib/bill_forward/mutable_entity.rb +3 -3
- data/lib/bill_forward/version.rb +1 -1
- metadata +66 -90
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
5
|
-
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 61e73dfe374b644506689c0f003fff265a555c1b
|
4
|
+
data.tar.gz: d061d247a53d91d6f02bf6cf211a67e508f554e4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f60e60c2416ba69e636fb9d1dbd9e38bb538e1f164b6b16624757934b8ca80c8a99024a7c2c5a5864a316b4e6cf4f4dd2aa10721c7b88f68ec4bd39b754732a5
|
7
|
+
data.tar.gz: d357954097bf7a6db634db33b6d00eb11d62a4905158470e0f455575c7eb04f5e88291905b8f86d7ce5b643c639b8a6a7fc67ed4762a71241f0756ca3c318949
|
@@ -8,6 +8,42 @@ module BillForward
|
|
8
8
|
'at the time of writing, no API endpoint exists to support it.'+
|
9
9
|
'The entity can be GETted by ID only.'
|
10
10
|
end
|
11
|
+
|
12
|
+
def get_remaining_credit_on_account(id, query_params = {}, custom_client = nil)
|
13
|
+
credit_notes = get_by_account_id(id, query_params, custom_client)
|
14
|
+
|
15
|
+
self.count_remaining_credit credit_notes
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_remaining_credit_on_subscription(id, query_params = {}, custom_client = nil)
|
19
|
+
credit_notes = get_by_subscription_id(id, query_params, custom_client)
|
20
|
+
|
21
|
+
self.count_remaining_credit credit_notes
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_by_account_id(id, query_params = {}, custom_client = nil)
|
25
|
+
raise ArgumentError.new("id cannot be nil") if id.nil?
|
26
|
+
|
27
|
+
endpoint = sprintf('account/%s',
|
28
|
+
ERB::Util.url_encode(id)
|
29
|
+
)
|
30
|
+
|
31
|
+
self.request_many('get', endpoint, query_params, custom_client)
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_by_subscription_id(id, query_params = {}, custom_client = nil)
|
35
|
+
raise ArgumentError.new("id cannot be nil") if id.nil?
|
36
|
+
|
37
|
+
endpoint = sprintf('subscription/%s',
|
38
|
+
ERB::Util.url_encode(id)
|
39
|
+
)
|
40
|
+
|
41
|
+
self.request_many('get', endpoint, query_params, custom_client)
|
42
|
+
end
|
43
|
+
protected
|
44
|
+
def count_remaining_credit(credit_notes)
|
45
|
+
credit_notes.map(&:remainingValue).inject(0, :+)
|
46
|
+
end
|
11
47
|
end
|
12
48
|
end
|
13
49
|
end
|
@@ -18,10 +18,10 @@ module BillForward
|
|
18
18
|
# @note As-yet untested
|
19
19
|
#
|
20
20
|
# @return [self] The retired Entity
|
21
|
-
def delete
|
22
|
-
self.class.request_first('delete',
|
21
|
+
def delete
|
22
|
+
self.class.request_first('delete', ERB::Util.url_encode(id), nil, nil, _client)
|
23
23
|
end
|
24
24
|
|
25
25
|
alias_method :retire, :delete
|
26
26
|
end
|
27
|
-
end
|
27
|
+
end
|
data/lib/bill_forward/version.rb
CHANGED
metadata
CHANGED
@@ -1,106 +1,83 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: bill_forward
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2016.26
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- BillForward
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
|
12
|
+
date: 2016-01-27 00:00:00 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
14
15
|
name: rest-client
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ~>
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.4'
|
20
|
-
type: :runtime
|
21
16
|
prerelease: false
|
22
|
-
|
23
|
-
requirements:
|
24
|
-
- - ~>
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.4'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: json
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
17
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
31
19
|
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: "1.4"
|
34
22
|
type: :runtime
|
23
|
+
version_requirements: *id001
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: json
|
35
26
|
prerelease: false
|
36
|
-
|
37
|
-
requirements:
|
27
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
38
29
|
- - ~>
|
39
|
-
- !ruby/object:Gem::Version
|
30
|
+
- !ruby/object:Gem::Version
|
40
31
|
version: 1.8.1
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: require_all
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '>='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
32
|
type: :runtime
|
33
|
+
version_requirements: *id002
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: require_all
|
49
36
|
prerelease: false
|
50
|
-
|
51
|
-
requirements:
|
52
|
-
-
|
53
|
-
-
|
54
|
-
|
55
|
-
|
37
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- &id005
|
40
|
+
- ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: "0"
|
43
|
+
type: :runtime
|
44
|
+
version_requirements: *id003
|
45
|
+
- !ruby/object:Gem::Dependency
|
56
46
|
name: bundler
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.6'
|
62
|
-
type: :development
|
63
47
|
prerelease: false
|
64
|
-
|
65
|
-
requirements:
|
48
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
66
50
|
- - ~>
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version:
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '>='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: "1.6"
|
76
53
|
type: :development
|
54
|
+
version_requirements: *id004
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
77
57
|
prerelease: false
|
78
|
-
|
79
|
-
requirements:
|
80
|
-
-
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rake
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - '>='
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
58
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- *id005
|
90
61
|
type: :development
|
62
|
+
version_requirements: *id006
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: rake
|
91
65
|
prerelease: false
|
92
|
-
|
93
|
-
requirements:
|
94
|
-
-
|
95
|
-
|
96
|
-
|
66
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- *id005
|
69
|
+
type: :development
|
70
|
+
version_requirements: *id007
|
97
71
|
description: Enables you to call the BillForward API easily using Ruby
|
98
|
-
email:
|
72
|
+
email:
|
99
73
|
- support@billforward.net
|
100
74
|
executables: []
|
75
|
+
|
101
76
|
extensions: []
|
77
|
+
|
102
78
|
extra_rdoc_files: []
|
103
|
-
|
79
|
+
|
80
|
+
files:
|
104
81
|
- .gitignore
|
105
82
|
- .idea/.name
|
106
83
|
- .idea/compiler.xml
|
@@ -200,30 +177,29 @@ files:
|
|
200
177
|
- tools/local_bundle_build.sh
|
201
178
|
- tools/local_bundle_install.sh
|
202
179
|
homepage: http://www.billforward.net
|
203
|
-
licenses:
|
180
|
+
licenses:
|
204
181
|
- MIT
|
205
182
|
metadata: {}
|
183
|
+
|
206
184
|
post_install_message:
|
207
185
|
rdoc_options: []
|
208
|
-
|
186
|
+
|
187
|
+
require_paths:
|
209
188
|
- lib
|
210
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
211
|
-
requirements:
|
212
|
-
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
requirements:
|
217
|
-
- - '>='
|
218
|
-
- !ruby/object:Gem::Version
|
219
|
-
version: '0'
|
189
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- *id005
|
192
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
|
+
requirements:
|
194
|
+
- *id005
|
220
195
|
requirements: []
|
196
|
+
|
221
197
|
rubyforge_project:
|
222
|
-
rubygems_version: 2.
|
198
|
+
rubygems_version: 2.0.14
|
223
199
|
signing_key:
|
224
200
|
specification_version: 4
|
225
201
|
summary: BillForward Ruby Client Library
|
226
|
-
test_files:
|
202
|
+
test_files:
|
227
203
|
- spec/component/account_spec.rb
|
228
204
|
- spec/component/billing_entity_spec.rb
|
229
205
|
- spec/component/invoice_spec.rb
|