killbill-client 0.4.6 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,24 @@
1
+ language: ruby
2
+
3
+ notifications:
4
+ email:
5
+ - kill-bill-commits@googlegroups.com
6
+
7
+ rvm:
8
+ - 1.9.2
9
+ - 1.9.3
10
+ - 2.0.0
11
+ - ruby-head
12
+ - jruby-19mode
13
+ - jruby-20mode
14
+ - jruby-head
15
+
16
+ jdk:
17
+ - openjdk6
18
+ - openjdk7
19
+ - oraclejdk7
20
+
21
+ matrix:
22
+ allow_failures:
23
+ - rvm: ruby-head
24
+ - rvm: jruby-head
@@ -7,6 +7,17 @@ module KillBillClient
7
7
  KILLBILL_API_ACCOUNTS_PREFIX = "#{KILLBILL_API_PREFIX}/accounts"
8
8
 
9
9
  class << self
10
+ def find_in_batches(offset = 0, limit = 100, with_balance = false, with_balance_and_cba = false, options = {})
11
+ get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{Resource::KILLBILL_API_PAGINATION_PREFIX}",
12
+ {
13
+ :offset => offset,
14
+ :limit => limit,
15
+ :accountWithBalance => with_balance,
16
+ :accountWithBalanceAndCBA => with_balance_and_cba
17
+ },
18
+ options
19
+ end
20
+
10
21
  def find_by_id(account_id, with_balance = false, with_balance_and_cba = false, options = {})
11
22
  get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}",
12
23
  {
@@ -15,6 +26,17 @@ module KillBillClient
15
26
  },
16
27
  options
17
28
  end
29
+
30
+ def find_in_batches_by_search_key(search_key, offset = 0, limit = 100, with_balance = false, with_balance_and_cba = false, options = {})
31
+ get "#{KILLBILL_API_ACCOUNTS_PREFIX}/search/#{search_key}",
32
+ {
33
+ :offset => offset,
34
+ :limit => limit,
35
+ :accountWithBalance => with_balance,
36
+ :accountWithBalanceAndCBA => with_balance_and_cba
37
+ },
38
+ options
39
+ end
18
40
  end
19
41
 
20
42
  def create(user = nil, reason = nil, comment = nil, options = {})
@@ -11,7 +11,7 @@ module KillBillClient
11
11
 
12
12
  def create(external_payment = false, user = nil, reason = nil, comment = nil, options = {})
13
13
  # Nothing to return (nil)
14
- self.class.post "#{Invoice::KILLBILL_API_INVOICES_PREFIX}/payments",
14
+ self.class.post "#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/payments",
15
15
  to_json,
16
16
  {
17
17
  :externalPayment => external_payment
@@ -20,9 +20,11 @@ module KillBillClient
20
20
  options
21
21
  end
22
22
 
23
- def find_all_by_search_key(search_key, with_plugin_info = false, options = {})
23
+ def find_in_batches_by_search_key(search_key, offset = 0, limit = 100, with_plugin_info = false, options = {})
24
24
  get "#{KILLBILL_API_PAYMENT_METHODS_PREFIX}/search/#{search_key}",
25
25
  {
26
+ :offset => offset,
27
+ :limit => limit,
26
28
  :withPluginInfo => with_plugin_info
27
29
  },
28
30
  options
@@ -9,6 +9,8 @@ module KillBillClient
9
9
  :response
10
10
 
11
11
  KILLBILL_API_PREFIX = '/1.0/kb/'
12
+ KILLBILL_API_PAGINATION_PREFIX = 'pagination'
13
+
12
14
  @@attribute_names = {}
13
15
 
14
16
  class << self
@@ -50,7 +52,13 @@ module KillBillClient
50
52
  when %r{application/json}
51
53
  record = from_json resource_class, response.body
52
54
  session_id = extract_session_id(response)
53
- record.instance_eval { @etag, @session_id, @response = response['ETag'], session_id, response }
55
+ record.instance_eval {
56
+ @etag = response['ETag']
57
+ @session_id = session_id
58
+ @pagination_nb_results = response['X-Killbill-Pagination-NbResults']
59
+ @pagination_total_nb_results = response['X-Killbill-Pagination-TotalNbResults']
60
+ @response = response
61
+ }
54
62
  record
55
63
  else
56
64
  raise ArgumentError, "#{response['Content-Type']} is not supported by the library"
@@ -86,7 +94,7 @@ module KillBillClient
86
94
 
87
95
  def instantiate_record_from_json(resource_class, data)
88
96
  record = resource_class.send :new
89
-
97
+
90
98
  data.each do |name, value|
91
99
  name = Utils.underscore name
92
100
  attr_desc = @@attribute_names[record.class.name][name.to_sym] rescue nil
@@ -4,6 +4,8 @@ module KillBillClient
4
4
 
5
5
  attr_reader :etag,
6
6
  :session_id,
7
+ :pagination_nb_results,
8
+ :pagination_total_nb_results,
7
9
  :response
8
10
 
9
11
  end
@@ -1,8 +1,8 @@
1
1
  module KillBillClient
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 4
5
- PATCH = 6
4
+ MINOR = 5
5
+ PATCH = 0
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
metadata CHANGED
@@ -1,57 +1,64 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.5.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Killbill core team
8
- autorequire:
9
+ autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-10-18 00:00:00.000000000 Z
12
+ date: 2013-10-22 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: json
15
- requirement: !ruby/object:Gem::Requirement
16
+ version_requirements: !ruby/object:Gem::Requirement
16
17
  requirements:
17
18
  - - ~>
18
19
  - !ruby/object:Gem::Version
19
20
  version: 1.8.0
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
21
+ none: false
22
+ requirement: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.8.0
27
+ none: false
28
+ prerelease: false
29
+ type: :runtime
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: rake
29
- requirement: !ruby/object:Gem::Requirement
32
+ version_requirements: !ruby/object:Gem::Requirement
30
33
  requirements:
31
34
  - - '>='
32
35
  - !ruby/object:Gem::Version
33
36
  version: 10.0.0
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirement: !ruby/object:Gem::Requirement
37
39
  requirements:
38
40
  - - '>='
39
41
  - !ruby/object:Gem::Version
40
42
  version: 10.0.0
43
+ none: false
44
+ prerelease: false
45
+ type: :development
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: rspec
43
- requirement: !ruby/object:Gem::Requirement
48
+ version_requirements: !ruby/object:Gem::Requirement
44
49
  requirements:
45
50
  - - ~>
46
51
  - !ruby/object:Gem::Version
47
52
  version: 2.12.0
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirement: !ruby/object:Gem::Requirement
51
55
  requirements:
52
56
  - - ~>
53
57
  - !ruby/object:Gem::Version
54
58
  version: 2.12.0
59
+ none: false
60
+ prerelease: false
61
+ type: :development
55
62
  description: An API client library for Kill Bill.
56
63
  email: killbilling-users@googlegroups.com
57
64
  executables: []
@@ -59,6 +66,7 @@ extensions: []
59
66
  extra_rdoc_files: []
60
67
  files:
61
68
  - .gitignore
69
+ - .travis.yml
62
70
  - Gemfile
63
71
  - README.md
64
72
  - Rakefile
@@ -135,8 +143,7 @@ files:
135
143
  homepage: http://www.killbilling.org
136
144
  licenses:
137
145
  - Apache License (2.0)
138
- metadata: {}
139
- post_install_message:
146
+ post_install_message:
140
147
  rdoc_options:
141
148
  - --exclude
142
149
  - .
@@ -147,16 +154,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
154
  - - '>='
148
155
  - !ruby/object:Gem::Version
149
156
  version: 1.8.6
157
+ none: false
150
158
  required_rubygems_version: !ruby/object:Gem::Requirement
151
159
  requirements:
152
160
  - - '>='
153
161
  - !ruby/object:Gem::Version
162
+ segments:
163
+ - 0
154
164
  version: '0'
165
+ hash: 2
166
+ none: false
155
167
  requirements: []
156
- rubyforge_project:
157
- rubygems_version: 2.0.3
158
- signing_key:
159
- specification_version: 4
168
+ rubyforge_project:
169
+ rubygems_version: 1.8.24
170
+ signing_key:
171
+ specification_version: 3
160
172
  summary: Kill Bill client library.
161
173
  test_files:
162
174
  - spec/killbill_client/model_relation_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 96687e10cab322b867c1387c71d4f30c81ec0328
4
- data.tar.gz: 5cb7fa0eece1a870191f7bf21ae67e3ce7f8d486
5
- SHA512:
6
- metadata.gz: b0db60114e796354ecc0eb01762e2285bb677706be18735e69a7f82f28d1dcd2206d9116b982719eeefc3810de5d114fd907ef3ca4d1117157c95f42b19c844a
7
- data.tar.gz: a1c2bc7aa82982dc2b7076675f38e963fb0177f52bdc3e5486530cfdee37ac37d430eb2f56e2227eade58dc23b51186135c4306ea8376729d5ce2acbd09a32b1