Skip to content

Commit

Permalink
Added System API calls
Browse files Browse the repository at this point in the history
  • Loading branch information
anlek authored and bcurren committed Feb 13, 2014
1 parent c70b209 commit 37b4852
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/freshbooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
require 'active_support/all'

require 'freshbooks/base'
require 'freshbooks/address'
require 'freshbooks/api'
require 'freshbooks/autobill'
require 'freshbooks/budget'
require 'freshbooks/card'
Expand All @@ -35,6 +37,7 @@
require 'freshbooks/recurring'
require 'freshbooks/response'
require 'freshbooks/staff'
require 'freshbooks/system'
require 'freshbooks/task'
require 'freshbooks/time_entry'

Expand Down
7 changes: 7 additions & 0 deletions lib/freshbooks/address.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module FreshBooks
class Address < FreshBooks::Base
define_schema do |s|
s.string :street1, :street2, :city, :state, :country, :code
end
end
end
7 changes: 7 additions & 0 deletions lib/freshbooks/api.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module FreshBooks
class Api < FreshBooks::Base
define_schema do |s|
s.fixnum :requests, :request_limit
end
end
end
14 changes: 14 additions & 0 deletions lib/freshbooks/system.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module FreshBooks
class System < FreshBooks::Base
define_schema do |s|
s.string :company_name, :profession
s.object :address
s.object :api
end

def self.current
response = FreshBooks::Base.connection.call_api("#{api_class_name}.current")
response.success? ? self.new_from_xml(response.elements[1]) : nil
end
end
end

0 comments on commit 37b4852

Please sign in to comment.