quick_book_gateway 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 851b66e6a5c13cda71cadd30f647ff29efd9f453
4
- data.tar.gz: 981305ca194a403b00fa359ec92d8ec9e9d93e0d
3
+ metadata.gz: 3c8d6f892535dd7bd3d268c41b800805c5127a3b
4
+ data.tar.gz: 33ceb4988781d01fe856a0d034c5d5807cf51b74
5
5
  SHA512:
6
- metadata.gz: 4f4b7d16a39071ff90781f9969c48b5c8c2b21ddfc75b83d71b63c4c2b8800e9f222c2da384c9d539851b307fedb11361e9cfb4d6c1b636b53376c4870aa9e4d
7
- data.tar.gz: 9d203c40fd021dd5e4d9895d3477f52c7c8f0daef028eb1e10d424c13bdf1884df699e99eeaa790f5f3bcf0cc24261cb7503e68bf2b43dd49284df23da72731f
6
+ metadata.gz: fdedd1f3a31a592b01c8df6c127249613259d388c5a1cd76e3b187136cb43a095c6b2fd9ca4c6a6e528d23f71ebdafa0abfb88bfaf6e63b6658a042b624ccd45
7
+ data.tar.gz: e10c5855b3006c6a4b25b1132823ef382e458bdba28f9b9a9b98934f0f82ce6a59ab20394b1c6ffc71e085538a2ca29dfb5243591cd97bc9b62d2e28fa366e72
data/README ADDED
@@ -0,0 +1,83 @@
1
+ ## Requirements
2
+
3
+ * Ruby >= 0
4
+ * OAuth
5
+ * Quickbook tokens
6
+
7
+
8
+ ## Installation
9
+
10
+ * Execute below command
11
+ gem install quick_book_gateway
12
+
13
+ ## How to use
14
+
15
+ 1. Add line to your ruby program
16
+
17
+ require 'quick_book_gateway'
18
+
19
+
20
+ 2. Configure Quickbook by adding below line to your ruby program
21
+
22
+ Gateway::Quickbook.connect(
23
+ :qb_key => Quickbook Key,
24
+ :qb_secret => Quickbook Secret,
25
+ :token => Access Token,
26
+ :secret => Access Sceret,
27
+ :company_id => Quickbook Company ID,
28
+ :environment => ENVIRONMENT::SANDBOX or ENVIRONMENT::PRODUCTION
29
+ )
30
+
31
+ 3. Create classes with names provided on Quickbook website
32
+
33
+ https://developer.intuit.com/v2/apiexplorer?apiname=V3QBO
34
+
35
+ For ex. Account, Customer, Vendor, Invoice, Item, etc
36
+
37
+
38
+ 4. Inherit all classes with Service::Record Class, class should look like below
39
+
40
+ class Customer < Service::Record
41
+ end
42
+
43
+ class Vendor < Service::Record
44
+ end
45
+
46
+ class Item < Service::Record
47
+ end
48
+
49
+ 5. You are ready to create, fetch or modify any data on Quickbook.
50
+
51
+ For ex.
52
+ Customer.find(DisplayName: "Kunal")
53
+ customer.CompanyName = "Kunal Lalge"
54
+ customer.save!
55
+
56
+ 6. For attributes reference read Documentation reference for each class on Quickbook link provided above.
57
+
58
+ For ex. https://developer.intuit.com/docs/api/accounting/customer
59
+
60
+ 7. One can also use callbacks, below are list of callbacks:
61
+
62
+ before_save - Executes every time before object save
63
+ after_save - Executes every time after object save
64
+ before_create - Executes only before new object save
65
+ after_create - Executes only after new object save
66
+ before_update - Executes only before existing object save
67
+ after_update - Executes only after existing object save
68
+ before_destroy - Executes every time before destroy an object
69
+ after_destroy - Executes every time after destroy an object
70
+
71
+ Ex.
72
+ class Customer < Service::Record
73
+ def after_create
74
+ puts "New customer is created on QB"
75
+ end
76
+ end
77
+
78
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
79
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
80
+ FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
81
+ AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
82
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
83
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -32,11 +32,11 @@ module Gateway
32
32
  #Options are as follow
33
33
  # String: Environment ENVIRONMENT::SANDBOX or ENVIRONMENT::PRODUCTION. AutoLoad QuickBook key, secret, access token, access secret, company ID from config/quickbook.yml corresponding to environment given.
34
34
  # Hash:
35
- # :qb_key => QuickBook Key
36
- # :qb_secret => QuickBook Secret
37
- # :token => Access Token
38
- # :secret => Access Sceret
39
- # :company_id => QuickBook Company ID
35
+ # :qb_key => QuickBook Key,
36
+ # :qb_secret => QuickBook Secret,
37
+ # :token => Access Token,
38
+ # :secret => Access Sceret,
39
+ # :company_id => QuickBook Company ID,
40
40
  # :environment => ENVIRONMENT::SANDBOX or ENVIRONMENT::PRODUCTION
41
41
  def self.connect(options)
42
42
  if(options.class == String)
@@ -13,12 +13,19 @@ require 'service/callback'
13
13
  require 'service/persistence'
14
14
  require 'service/record'
15
15
 
16
- Dir.glob("app/services/*.rb") do|service|
17
- require "./#{service}"
18
- end
19
-
20
16
  Dir.glob("quick_book_lib/*.rb") do|library|
21
17
  require "./#{library}"
22
18
  end if(File.exists?("quick_book_lib"))
23
19
 
20
+ service_failed = []
21
+ Dir.glob("app/services/*.rb") do|service|
22
+ begin
23
+ service_failed << service unless require "./#{service}"
24
+ rescue
25
+ service_failed << service
26
+ end
27
+ end
28
+
29
+ service_failed.each{|service| require "./#{service}"}
30
+
24
31
  Gateway::Quickbook.connect(Gateway::Quickbook::ENVIRONMENT::SANDBOX) if File.exist?("./config/quickbook.yml")
@@ -47,7 +47,7 @@ module Service
47
47
  #Try to find record on QuickBook Online as per options provided else create instance of new
48
48
  #Options should be an Hash contains columns and values to find record.
49
49
  # For ex. if you want to update customer(Kunal) country to India if exist or create new:
50
- # kunal = Customer.find_or_initialize({"DisplayName" => "Kunal")
50
+ # kunal = Customer.find_or_initialize({"DisplayName" => "Kunal"})
51
51
  # kunal.Country = "India"
52
52
  # kunal.save!
53
53
  def find_or_initialize(options)
@@ -3,10 +3,10 @@ module Service
3
3
  #QuickBook API documentation https://developer.intuit.com/v2/apiexplorer?apiname=V3QBO
4
4
  class Record
5
5
  @@quickbook_gateway
6
- @@entity
7
6
 
8
7
  extend Service::Finder
9
8
  include Service::Persistence
9
+ include Errors
10
10
 
11
11
  attr_accessor :attributes, :is_new_record
12
12
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quick_book_gateway
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kunal Lalge
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-25 00:00:00.000000000 Z
11
+ date: 2015-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth
@@ -24,12 +24,14 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- description: Connect to QuickBook Online and easily synchronize data.
27
+ description: 'Connect to QuickBook Online and easily synchronize data. Please read
28
+ README file to know how to use located at gems-directory/quick_book_gateway-0.0.2/README '
28
29
  email: kunallalge@gmail.com
29
30
  executables: []
30
31
  extensions: []
31
32
  extra_rdoc_files: []
32
33
  files:
34
+ - README
33
35
  - lib/core_ext/hash.rb
34
36
  - lib/core_ext/nil.rb
35
37
  - lib/core_ext/string.rb