quickbooks-ruby-base 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDY0NmRjNzY3NWIzZmRlNTc3MTIzMGZkMjI2MmViZTI0MDJkMTMxOQ==
4
+ ZmVlZjM5YjNkN2ZiMjQ4YzcwN2I2YTY4YTZlNTkxYThmM2E5ZDVlZA==
5
5
  data.tar.gz: !binary |-
6
- YzkzYzQ1NThjMDM3YWEyN2Q5OTYyOGE5NzM3NmRjZTlhY2FkOWEzZQ==
6
+ OTI4MzMzN2IxYWZjNDBiZGFkZmFlNmJhODJiYzg1ZDMxNDU0YzVjZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MmY3MWM5NmQ2MzY0MGM1NmU4N2EzMWYzZjllNzcyNjIyODMzN2Q0MDM1OGFk
10
- MTdiNjEzM2UzMDI0NWRlNTFlMTM2MTVhN2FiNzA0MWI0Y2VlZjM5OWI1NTMx
11
- Yjc0NjI4OTY0ZGQ3NTNiMmEyZGEyMmEzNzcyOTZmM2NjYWQxNjQ=
9
+ OWU1NmU0YmFjMmRkYjkyNzg2ZWM1ZGFjMWVjZGJlNjcwNzljMTg0MDc0OTZh
10
+ MmZjOGU0YWVhZTc3Nzk3MzA0ODYwZjNkZDFhZGFkYzI0ODBjOGYwZjUxYjY5
11
+ YmQ2NTQyNTliN2ZmMzE4NWE0Y2FkOGNiNDgyODhhNzE1NmIyZGY=
12
12
  data.tar.gz: !binary |-
13
- NDdmOWFhYjAxZTFlMTk5N2QwYjU5MjE2YjA4YzIyMjVhOTk5NTgzNjY3Njli
14
- NGUzNTc2MGFhYmYyZThkZjEwNDY0MjMxYzdlOTgwNDE2OGYzMGZjNzcyZTIz
15
- YWVhMmJhNjY3NzZhNmY1MDJhNTU5NDQ1MDc3NmIzYWZmZWM3MjI=
13
+ N2VjZWY0OWJiYjQ3NGYyYzYyN2ZmMDRkOGJlYTE2NTEwZTdkNjIxMmU5YzM0
14
+ NTk0MzcyZTgyZWI1ZGRmM2JhYmQ5NWNhMzVlMTc0NjgxMDE4ZTY3N2ZiMTEz
15
+ MDNhMjQ1YTQxNGFlZDc0OWNhOTA4M2MxY2FkZDU0NzQzMGFmZTE=
@@ -4,7 +4,7 @@ require_relative 'base/finders'
4
4
 
5
5
  module Quickbooks
6
6
  class Base
7
- attr_reader :service, :entity
7
+ attr_reader :service
8
8
  include Finders
9
9
  extend Configuration
10
10
 
@@ -13,18 +13,18 @@ module Quickbooks
13
13
  create_service_for(type) if type
14
14
  end
15
15
 
16
- def generate_quickbooks_ruby_namespace(entity, type = 'Model')
17
- @entity = entity.is_a?(Symbol) ? entity.to_s.camelcase : entity
18
- "Quickbooks::#{type}::#{@entity}"
16
+ def generate_quickbooks_ruby_namespace(type, variety = 'Model')
17
+ type = type.is_a?(Symbol) ? type.to_s.camelcase : type
18
+ "Quickbooks::#{variety}::#{type}"
19
19
  end
20
20
 
21
- def quickbooks_ruby_model(entity, *args)
22
- generate_quickbooks_ruby_namespace(entity, 'Model').constantize.new(*args)
21
+ def quickbooks_ruby_model(type, *args)
22
+ generate_quickbooks_ruby_namespace(type, 'Model').constantize.new(*args)
23
23
  end
24
24
  alias_method :qr_model, :quickbooks_ruby_model
25
25
 
26
- def quickbooks_ruby_service(entity)
27
- generate_quickbooks_ruby_namespace(entity, 'Service').constantize.new
26
+ def quickbooks_ruby_service(type)
27
+ generate_quickbooks_ruby_namespace(type, 'Service').constantize.new
28
28
  end
29
29
  alias_method :qr_service, :quickbooks_ruby_service
30
30
 
@@ -45,8 +45,12 @@ module Quickbooks
45
45
  'nil'
46
46
  end
47
47
 
48
+ def entity
49
+ @service.class.name.split('::').last
50
+ end
51
+
48
52
  def describing_method
49
- case @service.class.name
53
+ case entity
50
54
  when /(Item|TaxCode|PaymentMethod|Account)/
51
55
  'name'
52
56
  when /(Invoice|CreditMemo)/
@@ -11,7 +11,7 @@ module Quickbooks
11
11
  end
12
12
 
13
13
  def sql_builder(where, options = {})
14
- options[:entity] ||= @entity
14
+ options[:entity] ||= entity
15
15
  options[:select] ||= '*'
16
16
  "SELECT #{options[:select]} FROM #{options[:entity]} WHERE #{where}"
17
17
  end
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'quickbooks-ruby-base'
7
- spec.version = '1.4.0'
7
+ spec.version = '1.5.0'
8
8
  spec.authors = ["Christian"]
9
9
  spec.email = ["christian@minimul.com"]
10
10
  spec.summary = %q{Base class to provide common methods for the quickbooks-ruby gem}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quickbooks-ruby-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian