diff --git a/Gemfile.lock b/Gemfile.lock index 52d040f..f38039e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rubill (0.1.6) + rubill (0.1.7) json rest-client @@ -9,11 +9,11 @@ GEM remote: https://rubygems.org/ specs: diff-lcs (1.2.5) - domain_name (0.5.20160615) + domain_name (0.5.20161021) unf (>= 0.0.5, < 1.0.0) - http-cookie (1.0.2) + http-cookie (1.0.3) domain_name (~> 0.5) - json (2.0.1) + json (2.0.3) mime-types (3.1) mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) diff --git a/README.md b/README.md index 83cda50..d1a8094 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,13 @@ [![Build Status](https://travis-ci.org/ataber/rubill.svg?branch=master)](https://travis-ci.org/ataber/rubill) [![Code Climate](https://codeclimate.com/github/ataber/rubill/badges/gpa.svg)](https://codeclimate.com/github/ataber/rubill) -rubill -====== +# rubill Ruby interface to Bill.com's API -Bill.com's own documentation: http://developer.bill.com/api-documentation/overview/ +Bill.com's developer documentation: https://developer.bill.com/hc/en-us/categories/201195646 -====== - -Setup: +## Setup: ``` Rubill.configure do |config| @@ -21,11 +18,26 @@ Rubill.configure do |config| end ``` -====== - -Usage: - -Rubill exposes the following entities directly: Customer, Customer Contact, Bill, Chart of Account, ReceivedPayment, SentPayment, Vendor, and Invoice. +## Usage: + +Rubill exposes the following entities directly: + +* ActgClass +* Attachment +* Bill +* BillPayment +* ChartOfAccount +* Customer +* CustomerContact +* GetCheckImageData +* GetDisbursementData +* Invoice +* Item +* Location +* ReceivedPayment +* SentBillPayment +* SentPayment +* Vendor For each you can sync a hash-like record with Bill.com by calling for example @@ -33,4 +45,4 @@ For each you can sync a hash-like record with Bill.com by calling for example Rubill::Customer.create(attrs) ``` -The resulting return value will be a Rubill::Customer object, which you can update by modifying via hash assignment and then calling `save`. Note that this flow does not work for ReceivedPayments or SentPayments, as you will need to void and then recreate these records. +The resulting return value will be a `Rubill::Customer` object, which you can update by modifying via hash assignment and then calling `save`. Note that this flow does not work for ReceivedPayments or SentPayments, as you will need to void and then recreate these records. diff --git a/lib/rubill.rb b/lib/rubill.rb index e489388..f2dcd24 100644 --- a/lib/rubill.rb +++ b/lib/rubill.rb @@ -43,20 +43,8 @@ def sandbox end end -require "rubill/session" -require "rubill/query" require "rubill/base" -require "rubill/bill" -require "rubill/bill_payment" -require "rubill/chart_of_account" -require "rubill/invoice" -require "rubill/attachment" -require "rubill/sent_payment" -require "rubill/sent_bill_payment" -require "rubill/received_payment" -require "rubill/vendor" -require "rubill/customer" -require "rubill/customer_contact" -require "rubill/attachment" -require "rubill/get_disbursement_data" -require "rubill/get_check_image_data" +require "rubill/query" +require "rubill/session" + +Dir["#{File.dirname(__FILE__)}/rubill/entities/*.rb"].each { |f| require f } diff --git a/lib/rubill/actg_class.rb b/lib/rubill/entities/actg_class.rb similarity index 100% rename from lib/rubill/actg_class.rb rename to lib/rubill/entities/actg_class.rb diff --git a/lib/rubill/attachment.rb b/lib/rubill/entities/attachment.rb similarity index 100% rename from lib/rubill/attachment.rb rename to lib/rubill/entities/attachment.rb diff --git a/lib/rubill/bill.rb b/lib/rubill/entities/bill.rb similarity index 100% rename from lib/rubill/bill.rb rename to lib/rubill/entities/bill.rb diff --git a/lib/rubill/bill_payment.rb b/lib/rubill/entities/bill_payment.rb similarity index 100% rename from lib/rubill/bill_payment.rb rename to lib/rubill/entities/bill_payment.rb diff --git a/lib/rubill/chart_of_account.rb b/lib/rubill/entities/chart_of_account.rb similarity index 100% rename from lib/rubill/chart_of_account.rb rename to lib/rubill/entities/chart_of_account.rb diff --git a/lib/rubill/customer.rb b/lib/rubill/entities/customer.rb similarity index 54% rename from lib/rubill/customer.rb rename to lib/rubill/entities/customer.rb index d89f44c..495b083 100644 --- a/lib/rubill/customer.rb +++ b/lib/rubill/entities/customer.rb @@ -1,9 +1,5 @@ module Rubill class Customer < Base - def self.find_by_name(name) - where([Query::Filter.new("name", "=", name)]).first - end - def contacts CustomerContact.active_by_customer(id) end diff --git a/lib/rubill/customer_contact.rb b/lib/rubill/entities/customer_contact.rb similarity index 100% rename from lib/rubill/customer_contact.rb rename to lib/rubill/entities/customer_contact.rb diff --git a/lib/rubill/get_check_image_data.rb b/lib/rubill/entities/get_check_image_data.rb similarity index 100% rename from lib/rubill/get_check_image_data.rb rename to lib/rubill/entities/get_check_image_data.rb diff --git a/lib/rubill/get_disbursement_data.rb b/lib/rubill/entities/get_disbursement_data.rb similarity index 100% rename from lib/rubill/get_disbursement_data.rb rename to lib/rubill/entities/get_disbursement_data.rb diff --git a/lib/rubill/invoice.rb b/lib/rubill/entities/invoice.rb similarity index 100% rename from lib/rubill/invoice.rb rename to lib/rubill/entities/invoice.rb diff --git a/lib/rubill/entities/item.rb b/lib/rubill/entities/item.rb new file mode 100644 index 0000000..a4c364e --- /dev/null +++ b/lib/rubill/entities/item.rb @@ -0,0 +1,3 @@ +module Rubill + class Item < Base; end +end diff --git a/lib/rubill/location.rb b/lib/rubill/entities/location.rb similarity index 100% rename from lib/rubill/location.rb rename to lib/rubill/entities/location.rb diff --git a/lib/rubill/received_payment.rb b/lib/rubill/entities/received_payment.rb similarity index 100% rename from lib/rubill/received_payment.rb rename to lib/rubill/entities/received_payment.rb diff --git a/lib/rubill/sent_bill_payment.rb b/lib/rubill/entities/sent_bill_payment.rb similarity index 100% rename from lib/rubill/sent_bill_payment.rb rename to lib/rubill/entities/sent_bill_payment.rb diff --git a/lib/rubill/sent_payment.rb b/lib/rubill/entities/sent_payment.rb similarity index 100% rename from lib/rubill/sent_payment.rb rename to lib/rubill/entities/sent_payment.rb diff --git a/lib/rubill/vendor.rb b/lib/rubill/entities/vendor.rb similarity index 100% rename from lib/rubill/vendor.rb rename to lib/rubill/entities/vendor.rb diff --git a/rubill.gemspec b/rubill.gemspec index 12d4c45..9b6e35d 100644 --- a/rubill.gemspec +++ b/rubill.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'rubill' - s.version = '0.1.6' + s.version = '0.1.7' s.date = '2014-09-31' s.summary = "Interface with Bill.com" s.description = "A Ruby interface to Bill.com's API" @@ -11,16 +11,19 @@ Gem::Specification.new do |s| "lib/rubill/session.rb", "lib/rubill/query.rb", "lib/rubill/base.rb", - "lib/rubill/bill.rb", - "lib/rubill/bill_payment.rb", - "lib/rubill/invoice.rb", - "lib/rubill/sent_payment.rb", - "lib/rubill/sent_bill_payment.rb", - "lib/rubill/received_payment.rb", - "lib/rubill/vendor.rb", - "lib/rubill/customer.rb", - "lib/rubill/customer_contact.rb", - "lib/rubill/attachment.rb", + "lib/rubill/entities/bill.rb", + "lib/rubill/entities/bill_payment.rb", + "lib/rubill/entities/invoice.rb", + "lib/rubill/entities/sent_payment.rb", + "lib/rubill/entities/sent_bill_payment.rb", + "lib/rubill/entities/received_payment.rb", + "lib/rubill/entities/vendor.rb", + "lib/rubill/entities/customer.rb", + "lib/rubill/entities/customer_contact.rb", + "lib/rubill/entities/attachment.rb", + "lib/rubill/entities/location.rb", + "lib/rubill/entities/actg_class.rb", + "lib/rubill/entities/item.rb", ] s.homepage = 'http://rubygems.org/gems/rubill' s.license = 'MIT' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f8014a7..347fd4d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,4 +5,3 @@ RSpec.configure do |c| end -