billysbilling-rails 1.1.0 → 1.1.1

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # billysbilling-rails
2
2
 
3
- A Ruby wrapper for the [Billys Billing API](https://dev.billysbilling.dk/api). Se also the homepage of [Billys Billing ](https://billysbilling.dk/)
3
+ An API wrapper for the danish accounting program [Billys Billing](https://dev.billysbilling.dk/api). Se also the homepage of [Billys Billing ](https://billysbilling.dk/)
4
4
 
5
5
  READ BILLYS BILLING API TERMS BEFORE USE: https://dev.billysbilling.dk/api-terms
6
6
 
@@ -43,6 +43,7 @@ If you for some reason need multiple instances of the client and do not want to
43
43
 
44
44
  ## Usage Examples
45
45
 
46
+ ```ruby
46
47
  client = BillysBilling.new(api_key: 'abcdefghijklmnopqrstuvxyz123456789')
47
48
 
48
49
  product_params = {
@@ -64,7 +65,7 @@ product_params = {
64
65
  product = client.create_product(product_params)
65
66
  product.description
66
67
  #=> "Very exciting story."
67
-
68
+ ```
68
69
 
69
70
  ## Contributing
70
71
 
@@ -28,8 +28,8 @@ module BillysBilling
28
28
 
29
29
  def method_missing(method, *arguments, &block)
30
30
  # the first argument is a Symbol, so you need to_s it if you want to pattern match
31
- if method.to_s =~ /^(#{valid_actions.join("|")})_(#{valid_queries.join("s?|")})(!?)/ && respond_to?($1)
32
- send("#{$1}#{$3}", *[$2.pluralize].concat(arguments), &block)
31
+ if method.to_s =~ /^(#{valid_actions.join("|")})_(#{valid_queries.join("s?|")})(!?)/
32
+ send("#{$1}#{$3}", *[$2.billyfy].concat(arguments), &block)
33
33
  else
34
34
  super
35
35
  end
@@ -82,11 +82,10 @@ module BillysBilling
82
82
 
83
83
  def index(class_name, params={}, options={})
84
84
  params = {q: params} if params.is_a?(String)
85
-
86
85
  list = []
87
86
  response = get_request("/#{class_name}", params, options)
88
87
  if response.success?
89
- response[class_name].each do |instance|
88
+ response[class_name.rubyify].each do |instance|
90
89
  list << get_class_instance(class_name, instance)
91
90
  end
92
91
  return list
@@ -2,7 +2,7 @@ module BillysBilling
2
2
  class Version #:nodoc:
3
3
  @major = 1
4
4
  @minor = 1
5
- @tiny = 0
5
+ @tiny = 1
6
6
  @build = nil
7
7
 
8
8
  class << self
@@ -9,7 +9,8 @@ autoload :Line, "billys_billing/line"
9
9
 
10
10
 
11
11
  require 'hash'
12
- require "active_support/inflector"
12
+ require 'string'
13
+ require 'active_support/inflector'
13
14
 
14
15
  require 'billys_billing/base'
15
16
 
data/lib/string.rb ADDED
@@ -0,0 +1,13 @@
1
+ require "active_support/inflector"
2
+
3
+ class String
4
+
5
+ def rubyify
6
+ self.underscore
7
+ end
8
+
9
+ def billyfy
10
+ self.to_s.camelize(:lower).pluralize
11
+ end
12
+
13
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: billysbilling-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-24 00:00:00.000000000 Z
12
+ date: 2012-10-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -195,6 +195,7 @@ files:
195
195
  - lib/billysbilling-rails.rb
196
196
  - lib/billysbilling.rb
197
197
  - lib/hash.rb
198
+ - lib/string.rb
198
199
  - spec/billys_billing/base_spec.rb
199
200
  - spec/billys_billing/invoice_spec.rb
200
201
  - spec/billys_billing/request_spec.rb