concur_connect 0.0.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/.document +11 -0
- data/.gitignore +40 -0
- data/.rspec +1 -0
- data/Gemfile +11 -0
- data/Guardfile +28 -0
- data/LICENSE +20 -0
- data/README.rdoc +28 -0
- data/Rakefile +42 -0
- data/concur_connect.gemspec +41 -0
- data/lib/concur_connect.rb +23 -0
- data/lib/concur_connect/expense_finder.rb +30 -0
- data/lib/concur_connect/expense_report.rb +21 -0
- data/lib/concur_connect/expense_report_finder.rb +44 -0
- data/lib/concur_connect/finder.rb +9 -0
- data/lib/concur_connect/itinerary.rb +5 -0
- data/lib/concur_connect/itinerary_finder.rb +35 -0
- data/lib/concur_connect/session.rb +44 -0
- data/lib/concur_connect/user.rb +17 -0
- data/lib/concur_connect/user_finder.rb +28 -0
- data/lib/concur_connect/version.rb +3 -0
- data/spec/concur_connect/expense.rb +5 -0
- data/spec/concur_connect/expense_finder_spec.rb +77 -0
- data/spec/concur_connect/expense_report_finder_spec.rb +81 -0
- data/spec/concur_connect/expense_report_spec.rb +5 -0
- data/spec/concur_connect/itinerary_finder_spec.rb +43 -0
- data/spec/concur_connect/user_finder_spec.rb +26 -0
- data/spec/concur_connect/user_spec.rb +21 -0
- data/spec/concur_connect_spec.rb +30 -0
- data/spec/fixtures/vcr_cassettes/GET_user/v1_0/User.yml +40 -0
- data/spec/fixtures/vcr_cassettes/expense_list.yml +36 -0
- data/spec/fixtures/vcr_cassettes/expense_report_list_by_date.yml +35 -0
- data/spec/fixtures/vcr_cassettes/expense_report_list_by_status.yml +37 -0
- data/spec/fixtures/vcr_cassettes/itinerary_list.yml +37 -0
- data/spec/fixtures/vcr_cassettes/session_expense_reports.yml +35 -0
- data/spec/fixtures/vcr_cassettes/session_expenses.yml +36 -0
- data/spec/fixtures/vcr_cassettes/session_user.yml +38 -0
- data/spec/fixtures/vcr_cassettes/session_user_expense_reports.yml +34 -0
- data/spec/fixtures/vcr_cassettes/user.yml +40 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/support/vcr.rb +6 -0
- metadata +230 -0
| @@ -0,0 +1,17 @@ | |
| 1 | 
            +
            require 'concur_connect/expense_report'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module ConcurConnect
         | 
| 4 | 
            +
              class User
         | 
| 5 | 
            +
                attr_accessor :login_id, :first_name, :last_name, :email,
         | 
| 6 | 
            +
                  :country_code, :currency_code, :country_sub_code,
         | 
| 7 | 
            +
                  :session
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                def expense_reports(status = 'APPROVED', date = nil)
         | 
| 10 | 
            +
                  @expense_reports ||= expense_report_finder.find(login_id, status, date)
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                def expense_report_finder
         | 
| 14 | 
            +
                  @expense_report_finder ||= ExpenseReportFinder.new session
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
            end
         | 
| @@ -0,0 +1,28 @@ | |
| 1 | 
            +
            require 'concur_connect/user'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module ConcurConnect
         | 
| 4 | 
            +
              class UserFinder
         | 
| 5 | 
            +
                attr_accessor :session
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                def initialize(session)
         | 
| 8 | 
            +
                  self.session = session
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                def find(id)
         | 
| 12 | 
            +
                  response = session.get 'user/v1.0/User' do |g|
         | 
| 13 | 
            +
                    g.headers['X-CompanyDomain'] = session.company_id
         | 
| 14 | 
            +
                    g.headers['X-UserID'] = id
         | 
| 15 | 
            +
                  end
         | 
| 16 | 
            +
                  build_user response.body
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                def build_user(response)
         | 
| 20 | 
            +
                  user = User.new
         | 
| 21 | 
            +
                  user.login_id = response['LoginId']
         | 
| 22 | 
            +
                  user.first_name = response['FirstName']
         | 
| 23 | 
            +
                  user.last_name = response['LastName']
         | 
| 24 | 
            +
                  user.session = session
         | 
| 25 | 
            +
                  user
         | 
| 26 | 
            +
                end
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
            end
         | 
| @@ -0,0 +1,77 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe ConcurConnect::ExpenseFinder do
         | 
| 4 | 
            +
              let(:session) { 
         | 
| 5 | 
            +
                ConcurConnect.session '3dcPjZyTeQziAndLnUALTI', 'ZipGipKjsd4ypFx2qcJ5sCuBY9FYbJlE', 't0026855k9r8'
         | 
| 6 | 
            +
              }
         | 
| 7 | 
            +
              let(:finder) { ConcurConnect::ExpenseFinder.new session }
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              describe '#find' do
         | 
| 10 | 
            +
                it 'gets a list of expense reports with a given status' do
         | 
| 11 | 
            +
                  VCR.use_cassette('expense list', :record => :once) do
         | 
| 12 | 
            +
                    list = finder.find('nABR4fUZDftz3veYYzMffJR5k3uLU7xQy')
         | 
| 13 | 
            +
                    list.should_not be_empty
         | 
| 14 | 
            +
                    list.each { |i| i.should be_a(ConcurConnect::Expense) }
         | 
| 15 | 
            +
                  end
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
              describe '#build_expenses' do
         | 
| 20 | 
            +
                it 'handles an empty list of expenses' do
         | 
| 21 | 
            +
                  ers = finder.build_expenses({'ExpenseEntriesList' => nil})
         | 
| 22 | 
            +
                  ers.should be_empty
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
                it 'builds a list of a single expense' do
         | 
| 25 | 
            +
                  ers = finder.build_expenses({'ExpenseEntriesList' => {
         | 
| 26 | 
            +
                    'ExpenseEntrySummary' => {
         | 
| 27 | 
            +
                      'ApprovedAmount' => '678.00000000', 
         | 
| 28 | 
            +
                      'Expense-Entry-Url' => 'http://www.concursolutions.com/api/expense/expensereport/v1.1/report/iiwEUE87weOisd2sF2hsq/entry/Irusj23j48hks9IIor92746SLL92039jfyd', 
         | 
| 29 | 
            +
                      'ExpenseName' => 'Advertising', 
         | 
| 30 | 
            +
                      'LocationName' => 'Redmond, Washington', 
         | 
| 31 | 
            +
                      'TransactionAmount' => '678.00000000', 
         | 
| 32 | 
            +
                      'TransactionCrnCode' => 'USD', 
         | 
| 33 | 
            +
                      'VendorDescription' => nil,
         | 
| 34 | 
            +
                      'VendorListName' => 'The Daily Herald'
         | 
| 35 | 
            +
                  }}})
         | 
| 36 | 
            +
                  ers.should_not be_empty
         | 
| 37 | 
            +
                  ers.each do |expense|
         | 
| 38 | 
            +
                    expense.should be_a(ConcurConnect::Expense)
         | 
| 39 | 
            +
                    expense.type.length.should > 0
         | 
| 40 | 
            +
                    expense.amount.to_f.should > 0
         | 
| 41 | 
            +
                    expense.vendor.length.should > 0
         | 
| 42 | 
            +
                  end
         | 
| 43 | 
            +
                end
         | 
| 44 | 
            +
                it 'builds a list of new expenses' do
         | 
| 45 | 
            +
                  ers = finder.build_expenses({'ExpenseEntriesList' => {
         | 
| 46 | 
            +
                    'ExpenseEntrySummary' => [{
         | 
| 47 | 
            +
                      'ApprovedAmount' => '678.00000000', 
         | 
| 48 | 
            +
                      'Expense-Entry-Url' => 'http://www.concursolutions.com/api/expense/expensereport/v1.1/report/iiwEUE87weOisd2sF2hsq/entry/Irusj23j48hks9IIor92746SLL92039jfyd', 
         | 
| 49 | 
            +
                      'ExpenseName' => 'Advertising', 
         | 
| 50 | 
            +
                      'LocationName' => 'Redmond, Washington', 
         | 
| 51 | 
            +
                      'TransactionAmount' => '678.00000000', 
         | 
| 52 | 
            +
                      'TransactionCrnCode' => 'USD', 
         | 
| 53 | 
            +
                      'VendorDescription' => nil,
         | 
| 54 | 
            +
                      'VendorListName' => 'The Daily Herald'
         | 
| 55 | 
            +
                  },
         | 
| 56 | 
            +
                  {
         | 
| 57 | 
            +
                      'ApprovedAmount' => '778.00000000', 
         | 
| 58 | 
            +
                      'Expense-Entry-Url' => 'http://www.concursolutions.com/api/expense/expensereport/v1.1/report/iiwEUE87weOisd2sF2hsq/entry/Irusj23j48hks9IIor92746SLL92039jfye', 
         | 
| 59 | 
            +
                      'ExpenseName' => 'Gas', 
         | 
| 60 | 
            +
                      'LocationName' => 'Tacoma, Washington', 
         | 
| 61 | 
            +
                      'TransactionAmount' => '778.00000000', 
         | 
| 62 | 
            +
                      'TransactionCrnCode' => 'USD', 
         | 
| 63 | 
            +
                      'VendorDescription' => nil,
         | 
| 64 | 
            +
                      'VendorListName' => 'The Daily Herald'
         | 
| 65 | 
            +
                  }
         | 
| 66 | 
            +
                  ]}})
         | 
| 67 | 
            +
                  ers.should_not be_empty
         | 
| 68 | 
            +
                  ers.each do |expense|
         | 
| 69 | 
            +
                    expense.should be_a(ConcurConnect::Expense)
         | 
| 70 | 
            +
                    expense.type.length.should > 0
         | 
| 71 | 
            +
                    expense.amount.to_f.should > 0
         | 
| 72 | 
            +
                    expense.vendor.length.should > 0
         | 
| 73 | 
            +
                  end
         | 
| 74 | 
            +
                end
         | 
| 75 | 
            +
              end
         | 
| 76 | 
            +
            end
         | 
| 77 | 
            +
             | 
| @@ -0,0 +1,81 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe ConcurConnect::ExpenseReportFinder do
         | 
| 4 | 
            +
              let(:session) { 
         | 
| 5 | 
            +
                ConcurConnect.session '3dcPjZyTeQziAndLnUALTI', 'ZipGipKjsd4ypFx2qcJ5sCuBY9FYbJlE', 't0026855k9r8'
         | 
| 6 | 
            +
              }
         | 
| 7 | 
            +
              let(:finder) { ConcurConnect::ExpenseReportFinder.new session }
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              describe '#find' do
         | 
| 10 | 
            +
                it 'gets a list of expense reports with a given status' do
         | 
| 11 | 
            +
                  VCR.use_cassette('expense_report list by status', :record => :once) do
         | 
| 12 | 
            +
                    list = finder.find('derek.kastner@brighterplanet.com', 'APPROVED')
         | 
| 13 | 
            +
                    list.should_not be_empty
         | 
| 14 | 
            +
                    list.each { |i| i.should be_a(ConcurConnect::ExpenseReport) }
         | 
| 15 | 
            +
                  end
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
                it 'gets a list of expense reports with a given status and last modified date' do
         | 
| 18 | 
            +
                  VCR.use_cassette('expense_report list by date', :record => :once) do
         | 
| 19 | 
            +
                    list = finder.find(nil, 'APPROVED', Time.now)
         | 
| 20 | 
            +
                    list.should_not be_empty
         | 
| 21 | 
            +
                    list.each { |i| i.should be_a(ConcurConnect::ExpenseReport) }
         | 
| 22 | 
            +
                  end
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
              end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              describe '#build_expense_reports' do
         | 
| 27 | 
            +
                it 'handles an empty list of expense reports' do
         | 
| 28 | 
            +
                  ers = finder.build_expense_reports({'ReportsList' => nil})
         | 
| 29 | 
            +
                  ers.should be_empty
         | 
| 30 | 
            +
                end
         | 
| 31 | 
            +
                it 'builds a list of a single expense report' do
         | 
| 32 | 
            +
                  ers = finder.build_expense_reports({'ReportsList' => {
         | 
| 33 | 
            +
                    'ReportSummary' => {
         | 
| 34 | 
            +
                      'ReportName' => 'August Expenses',
         | 
| 35 | 
            +
                      'ReportTotal' => '245.00000000',
         | 
| 36 | 
            +
                      'ReportId' => '14B7C9053CAA4864A27F',
         | 
| 37 | 
            +
                      'ReportDate' => '2010-08-06T00:00:00',
         | 
| 38 | 
            +
                      'LastComment' => '',
         | 
| 39 | 
            +
                      'Report-Details-Url' => 'http://www.concursolutions.com/api/expense/expensereport/v1.1/report/ndfsdfseSDFDwaXZesdsfs',
         | 
| 40 | 
            +
                      'Report-Full-Details-Url' => 'http://www.concursolutions.com/api/expense/expensereport/v1.1/reportfulldetails/ndfsdfseSDFDwaXZesdsfs'
         | 
| 41 | 
            +
                  }}})
         | 
| 42 | 
            +
                  ers.should_not be_empty
         | 
| 43 | 
            +
                  ers.each do |expense_report|
         | 
| 44 | 
            +
                    expense_report.should be_a(ConcurConnect::ExpenseReport)
         | 
| 45 | 
            +
                    expense_report.id.should =~ /^[A-F0-9]+$/
         | 
| 46 | 
            +
                    expense_report.name.should == 'August Expenses'
         | 
| 47 | 
            +
                    expense_report.date.should =~ /\d{4}-\d\d-\d\d/
         | 
| 48 | 
            +
                  end
         | 
| 49 | 
            +
                end
         | 
| 50 | 
            +
                it 'builds a list of new expense reports' do
         | 
| 51 | 
            +
                  ers = finder.build_expense_reports({'ReportsList' => {
         | 
| 52 | 
            +
                    'ReportSummary' => [{
         | 
| 53 | 
            +
                      'ReportName' => 'August Expenses',
         | 
| 54 | 
            +
                      'ReportTotal' => '245.00000000',
         | 
| 55 | 
            +
                      'ReportId' => '14B7C9053CAA4864A27F',
         | 
| 56 | 
            +
                      'ReportDate' => '2010-08-06T00:00:00',
         | 
| 57 | 
            +
                      'LastComment' => '',
         | 
| 58 | 
            +
                      'Report-Details-Url' => 'http://www.concursolutions.com/api/expense/expensereport/v1.1/report/ndfsdfseSDFDwaXZesdsfs',
         | 
| 59 | 
            +
                      'Report-Full-Details-Url' => 'http://www.concursolutions.com/api/expense/expensereport/v1.1/reportfulldetails/ndfsdfseSDFDwaXZesdsfs'
         | 
| 60 | 
            +
                  },
         | 
| 61 | 
            +
                  {
         | 
| 62 | 
            +
                      'ReportName' => 'September Expenses',
         | 
| 63 | 
            +
                      'ReportTotal' => '345.00000000',
         | 
| 64 | 
            +
                      'ReportId' => '14B7C9053CAA4864A27F',
         | 
| 65 | 
            +
                      'ReportDate' => '2011-09-06T00:00:00',
         | 
| 66 | 
            +
                      'LastComment' => '',
         | 
| 67 | 
            +
                      'Report-Details-Url' => 'http://www.concursolutions.com/api/expense/expensereport/v1.1/report/ndfsdfseSDFDwaXZesdsfs',
         | 
| 68 | 
            +
                      'Report-Full-Details-Url' => 'http://www.concursolutions.com/api/expense/expensereport/v1.1/reportfulldetails/ndfsdfseSDFDwaXZesdsfs'
         | 
| 69 | 
            +
                  }
         | 
| 70 | 
            +
                  ]}})
         | 
| 71 | 
            +
                  ers.should_not be_empty
         | 
| 72 | 
            +
                  ers.each do |expense_report|
         | 
| 73 | 
            +
                    expense_report.should be_a(ConcurConnect::ExpenseReport)
         | 
| 74 | 
            +
                    expense_report.id.should =~ /^[A-F0-9]+$/
         | 
| 75 | 
            +
                    expense_report.name.length.should > 0
         | 
| 76 | 
            +
                    expense_report.date.should =~ /\d{4}-\d\d-\d\d/
         | 
| 77 | 
            +
                  end
         | 
| 78 | 
            +
                end
         | 
| 79 | 
            +
              end
         | 
| 80 | 
            +
            end
         | 
| 81 | 
            +
             | 
| @@ -0,0 +1,43 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe ConcurConnect::ItineraryFinder do
         | 
| 4 | 
            +
              let(:session) { 
         | 
| 5 | 
            +
                ConcurConnect.session '3dcPjZyTeQziAndLnUALTI', 'ZipGipKjsd4ypFx2qcJ5sCuBY9FYbJlE', 't0026855k9r8'
         | 
| 6 | 
            +
              }
         | 
| 7 | 
            +
              let(:finder) { ConcurConnect::ItineraryFinder.new session }
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              describe '#find' do
         | 
| 10 | 
            +
                it 'finds and builds a list of itineraries' do
         | 
| 11 | 
            +
                  VCR.use_cassette('itinerary list', :record => :once) do
         | 
| 12 | 
            +
                    list = finder.find('derek.kastner@brighterplanet.com')
         | 
| 13 | 
            +
                    list.should_not be_empty
         | 
| 14 | 
            +
                    list.each { |i| i.should be_a(ConcurConnect::Itinerary) }
         | 
| 15 | 
            +
                  end
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
              describe '#build_itineraries' do
         | 
| 20 | 
            +
                it 'handles an empty list of itineraries' do
         | 
| 21 | 
            +
                  is = finder.build_itineraries({'ItineraryInfoList' => nil})
         | 
| 22 | 
            +
                  is.should be_empty
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
                it 'builds a list of new itineraries' do
         | 
| 25 | 
            +
                  is = finder.build_itineraries({'ItineraryInfoList' => {
         | 
| 26 | 
            +
                    'ItineraryInfo' => [{
         | 
| 27 | 
            +
                      'id' => 'https://www.concursoultions.com/api/travel/trip/v1.0/4294967509',
         | 
| 28 | 
            +
                      'TripName' => 'My Trip',
         | 
| 29 | 
            +
                      'StartDateLocal' => '2010-02-15T09:00:00',
         | 
| 30 | 
            +
                      'EndDateLocal' => '2010-02-15T09:00:00'
         | 
| 31 | 
            +
                  }]}})
         | 
| 32 | 
            +
                  is.should_not be_empty
         | 
| 33 | 
            +
                  is.each do |itinerary|
         | 
| 34 | 
            +
                    itinerary.should be_a(ConcurConnect::Itinerary)
         | 
| 35 | 
            +
                    itinerary.concur_id.should =~ /http/
         | 
| 36 | 
            +
                    itinerary.name.should =~ /\w+/
         | 
| 37 | 
            +
                    itinerary.start_date.should =~ /\d{4}-\d\d-\d\d/
         | 
| 38 | 
            +
                    itinerary.end_date.should =~ /\d{4}-\d\d-\d\d/
         | 
| 39 | 
            +
                  end
         | 
| 40 | 
            +
                end
         | 
| 41 | 
            +
              end
         | 
| 42 | 
            +
            end
         | 
| 43 | 
            +
             | 
| @@ -0,0 +1,26 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe ConcurConnect::UserFinder do
         | 
| 4 | 
            +
              let(:session) { 
         | 
| 5 | 
            +
                ConcurConnect.session '3dcPjZyTeQziAndLnUALTI', 'ZipGipKjsd4ypFx2qcJ5sCuBY9FYbJlE', 't0026855k9r8'
         | 
| 6 | 
            +
              }
         | 
| 7 | 
            +
              let(:finder) { ConcurConnect::UserFinder.new session }
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              describe '#find' do
         | 
| 10 | 
            +
                it 'finds and builds a user' do
         | 
| 11 | 
            +
                  VCR.use_cassette('user', :record => :once) do
         | 
| 12 | 
            +
                    user = finder.find('derek.kastner@brighterplanet.com')
         | 
| 13 | 
            +
                    user.should be_a(ConcurConnect::User)
         | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
              describe '#build_user' do
         | 
| 19 | 
            +
                it 'builds a new user' do
         | 
| 20 | 
            +
                  u = finder.build_user({'LoginId' => 'user@example.com'})
         | 
| 21 | 
            +
                  u.should be_a(ConcurConnect::User)
         | 
| 22 | 
            +
                  u.login_id.should == 'user@example.com'
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
              end
         | 
| 25 | 
            +
            end
         | 
| 26 | 
            +
             | 
| @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
            require 'concur_connect/user'
         | 
| 3 | 
            +
            require 'concur_connect/expense_report'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            describe ConcurConnect::User do
         | 
| 6 | 
            +
              #describe '#itineraries' do
         | 
| 7 | 
            +
                #let(:user) { ConcurConnect::User.new }
         | 
| 8 | 
            +
                #it 'fetches all itineraries for the user if no date is specified' do
         | 
| 9 | 
            +
                  #user.itineraries
         | 
| 10 | 
            +
                #end
         | 
| 11 | 
            +
                #it 'fetches all itineraries for the user after a specified date'
         | 
| 12 | 
            +
              #end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              describe '#expense_reports' do
         | 
| 15 | 
            +
                it 'fetches all the expense reports for the user' do
         | 
| 16 | 
            +
                  pending
         | 
| 17 | 
            +
                  u.expense_reports.should_not be_empty
         | 
| 18 | 
            +
                  u.expense_reports.each { |er| er.should be_a?(ExpenseReport) }
         | 
| 19 | 
            +
                end
         | 
| 20 | 
            +
              end
         | 
| 21 | 
            +
            end
         | 
| @@ -0,0 +1,30 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe ConcurConnect do
         | 
| 4 | 
            +
              it 'is easy to use' do
         | 
| 5 | 
            +
                concur = ConcurConnect.session '3dcPjZyTeQziAndLnUALTI', 'ZipGipKjsd4ypFx2qcJ5sCuBY9FYbJlE', 't0026855k9r8'
         | 
| 6 | 
            +
                concur.should be_a(ConcurConnect::Session)
         | 
| 7 | 
            +
                user = nil
         | 
| 8 | 
            +
                expense_reports = nil
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                VCR.use_cassette('session expense reports', :record => :once) do
         | 
| 11 | 
            +
                  expense_reports = concur.expense_reports Date.new(2011, 9, 1)
         | 
| 12 | 
            +
                  expense_reports.should_not be_empty
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                VCR.use_cassette('session expenses', :record => :once) do
         | 
| 16 | 
            +
                  expenses = expense_reports.first.expenses
         | 
| 17 | 
            +
                  expenses.should_not be_empty
         | 
| 18 | 
            +
                end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                VCR.use_cassette('session user', :record => :once) do
         | 
| 21 | 
            +
                  user = concur.user('derek.kastner@brighterplanet.com')
         | 
| 22 | 
            +
                  user.should be_a(ConcurConnect::User)
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                #VCR.use_cassette('session user expense reports', :record => :once) do
         | 
| 26 | 
            +
                  #reports = user.expense_reports
         | 
| 27 | 
            +
                  #reports.should_not be_empty
         | 
| 28 | 
            +
                #end
         | 
| 29 | 
            +
              end
         | 
| 30 | 
            +
            end
         | 
| @@ -0,0 +1,40 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            - !ruby/struct:VCR::HTTPInteraction
         | 
| 3 | 
            +
              request: !ruby/struct:VCR::Request
         | 
| 4 | 
            +
                method: :get
         | 
| 5 | 
            +
                uri: https://www.concursolutions.com:443/api/user/v1.0/User
         | 
| 6 | 
            +
                body: !!null 
         | 
| 7 | 
            +
                headers:
         | 
| 8 | 
            +
                  x-companydomain:
         | 
| 9 | 
            +
                  - t0026855k9r8
         | 
| 10 | 
            +
                  x-userid:
         | 
| 11 | 
            +
                  - derek.kastner@brighterplanet.com
         | 
| 12 | 
            +
                  authorization:
         | 
| 13 | 
            +
                  - OAuth oauth_consumer_key="3dcPjZyTeQziAndLnUALTI", oauth_nonce="2256b50d188b97c845313c9b0ef30f32",
         | 
| 14 | 
            +
                    oauth_signature="7YvuAEg6v35sSPloetgEijy1heE%3D", oauth_signature_method="HMAC-SHA1",
         | 
| 15 | 
            +
                    oauth_timestamp="1322069185", oauth_version="1.0"
         | 
| 16 | 
            +
                  accept-encoding:
         | 
| 17 | 
            +
                  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
         | 
| 18 | 
            +
              response: !ruby/struct:VCR::Response
         | 
| 19 | 
            +
                status: !ruby/struct:VCR::ResponseStatus
         | 
| 20 | 
            +
                  code: 200
         | 
| 21 | 
            +
                  message: OK
         | 
| 22 | 
            +
                headers:
         | 
| 23 | 
            +
                  cache-control:
         | 
| 24 | 
            +
                  - private
         | 
| 25 | 
            +
                  content-type:
         | 
| 26 | 
            +
                  - application/xml
         | 
| 27 | 
            +
                  server:
         | 
| 28 | 
            +
                  - Microsoft-IIS/7.5
         | 
| 29 | 
            +
                  x-aspnet-version:
         | 
| 30 | 
            +
                  - 2.0.50727
         | 
| 31 | 
            +
                  x-powered-by:
         | 
| 32 | 
            +
                  - ASP.NET
         | 
| 33 | 
            +
                  webserver:
         | 
| 34 | 
            +
                  - usseatuicte53
         | 
| 35 | 
            +
                  date:
         | 
| 36 | 
            +
                  - Wed, 23 Nov 2011 17:26:25 GMT
         | 
| 37 | 
            +
                  content-length:
         | 
| 38 | 
            +
                  - '1007'
         | 
| 39 | 
            +
                body: <UserProfile xmlns="http://www.concursolutions.com/api/user/2011/02" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Active>Y</Active><CashAdvanceAccountCode/><CrnKey>USD</CrnKey><CtryCode>US</CtryCode><CtrySubCode/><Custom1/><Custom10/><Custom11/><Custom12/><Custom13/><Custom14/><Custom15/><Custom16/><Custom17/><Custom18/><Custom19/><Custom2/><Custom20/><Custom21/><Custom3/><Custom4/><Custom5/><Custom6/><Custom7/><Custom8/><Custom9/><EmailAddress>derek.kastner@brighterplanet.com</EmailAddress><EmpId>derek.kastner@brighterplanet.com</EmpId><ExpenseApprover>Y</ExpenseApprover><ExpenseApproverEmployeeID/><ExpenseUser>Y</ExpenseUser><FirstName>Derek</FirstName><InvoiceApprover>N</InvoiceApprover><InvoiceUser>N</InvoiceUser><IsTestEmp>N</IsTestEmp><LastName>Kastner</LastName><LedgerName>DEFAULT</LedgerName><LocaleName>en_US</LocaleName><LoginId>derek.kastner@brighterplanet.com</LoginId><Mi/><OrgUnit1/><OrgUnit2/><OrgUnit3/><OrgUnit4/><OrgUnit5/><OrgUnit6/><TripUser>N</TripUser></UserProfile>
         | 
| 40 | 
            +
                http_version: '1.1'
         | 
| @@ -0,0 +1,36 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            - !ruby/struct:VCR::HTTPInteraction
         | 
| 3 | 
            +
              request: !ruby/struct:VCR::Request
         | 
| 4 | 
            +
                method: :get
         | 
| 5 | 
            +
                uri: https://www.concursolutions.com:443/api/expense/expensereport/v1.1/report/nABR4fUZDftz3veYYzMffJR5k3uLU7xQy/entries
         | 
| 6 | 
            +
                body: !!null 
         | 
| 7 | 
            +
                headers:
         | 
| 8 | 
            +
                  authorization:
         | 
| 9 | 
            +
                  - OAuth oauth_consumer_key="3dcPjZyTeQziAndLnUALTI", oauth_nonce="8fa77459e675b5a1edbe0bb7bfb1696c",
         | 
| 10 | 
            +
                    oauth_signature="q1beMM3icyK7HaC0jnARXIwoyHo%3D", oauth_signature_method="HMAC-SHA1",
         | 
| 11 | 
            +
                    oauth_timestamp="1324580513", oauth_version="1.0"
         | 
| 12 | 
            +
                  accept-encoding:
         | 
| 13 | 
            +
                  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
         | 
| 14 | 
            +
              response: !ruby/struct:VCR::Response
         | 
| 15 | 
            +
                status: !ruby/struct:VCR::ResponseStatus
         | 
| 16 | 
            +
                  code: 200
         | 
| 17 | 
            +
                  message: OK
         | 
| 18 | 
            +
                headers:
         | 
| 19 | 
            +
                  cache-control:
         | 
| 20 | 
            +
                  - private
         | 
| 21 | 
            +
                  content-type:
         | 
| 22 | 
            +
                  - application/xml
         | 
| 23 | 
            +
                  server:
         | 
| 24 | 
            +
                  - Microsoft-IIS/7.5
         | 
| 25 | 
            +
                  x-aspnet-version:
         | 
| 26 | 
            +
                  - 2.0.50727
         | 
| 27 | 
            +
                  webserver:
         | 
| 28 | 
            +
                  - usseaeuicte34
         | 
| 29 | 
            +
                  date:
         | 
| 30 | 
            +
                  - Thu, 22 Dec 2011 19:01:54 GMT
         | 
| 31 | 
            +
                  content-length:
         | 
| 32 | 
            +
                  - '1077'
         | 
| 33 | 
            +
                body: <ExpenseEntriesList xmlns="http://www.concursolutions.com/api/expense/expensereport/2011/03"
         | 
| 34 | 
            +
                  xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><ExpenseEntrySummary><ApprovedAmount>83.22000000</ApprovedAmount><Expense-Entry-Url>https://www.concursolutions.com/api/expense/expensereport/v1.1/report/nABR4fUZDftz3veYYzMffJR5k3uLU7xQy/entry/n7w$pAOZMAeLZLiZZHq6M764nL1AHtcMtQ</Expense-Entry-Url><ExpenseName>Gas</ExpenseName><LocationName/><TransactionAmount>83.22000000</TransactionAmount><TransactionCrnCode>USD</TransactionCrnCode><VendorDescription/><VendorListName/></ExpenseEntrySummary><ExpenseEntrySummary><ApprovedAmount>179.82000000</ApprovedAmount><Expense-Entry-Url>https://www.concursolutions.com/api/expense/expensereport/v1.1/report/nABR4fUZDftz3veYYzMffJR5k3uLU7xQy/entry/n7w$pAOZByd82Y9p6KwXMFISMo1mcNqatX</Expense-Entry-Url><ExpenseName>Personal
         | 
| 35 | 
            +
                  Car Mileage</ExpenseName><LocationName/><TransactionAmount>179.82000000</TransactionAmount><TransactionCrnCode>USD</TransactionCrnCode><VendorDescription/><VendorListName/></ExpenseEntrySummary></ExpenseEntriesList>
         | 
| 36 | 
            +
                http_version: '1.1'
         | 
| @@ -0,0 +1,35 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            - !ruby/struct:VCR::HTTPInteraction
         | 
| 3 | 
            +
              request: !ruby/struct:VCR::Request
         | 
| 4 | 
            +
                method: :get
         | 
| 5 | 
            +
                uri: https://www.concursolutions.com:443/api/expense/expensereport/v1.1/reportslist/APPROVED/LastModified?date=2011-12-22
         | 
| 6 | 
            +
                body: !!null 
         | 
| 7 | 
            +
                headers:
         | 
| 8 | 
            +
                  authorization:
         | 
| 9 | 
            +
                  - OAuth oauth_consumer_key="3dcPjZyTeQziAndLnUALTI", oauth_nonce="5a97820cd02e5126b3b219e81cd11991",
         | 
| 10 | 
            +
                    oauth_signature="bzj5lx%2BXN9Lr%2BdYMPIGYheyItbQ%3D", oauth_signature_method="HMAC-SHA1",
         | 
| 11 | 
            +
                    oauth_timestamp="1324566949", oauth_version="1.0"
         | 
| 12 | 
            +
                  accept-encoding:
         | 
| 13 | 
            +
                  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
         | 
| 14 | 
            +
              response: !ruby/struct:VCR::Response
         | 
| 15 | 
            +
                status: !ruby/struct:VCR::ResponseStatus
         | 
| 16 | 
            +
                  code: 200
         | 
| 17 | 
            +
                  message: OK
         | 
| 18 | 
            +
                headers:
         | 
| 19 | 
            +
                  cache-control:
         | 
| 20 | 
            +
                  - private
         | 
| 21 | 
            +
                  content-type:
         | 
| 22 | 
            +
                  - application/xml
         | 
| 23 | 
            +
                  server:
         | 
| 24 | 
            +
                  - Microsoft-IIS/7.5
         | 
| 25 | 
            +
                  x-aspnet-version:
         | 
| 26 | 
            +
                  - 2.0.50727
         | 
| 27 | 
            +
                  webserver:
         | 
| 28 | 
            +
                  - usseatuicte66
         | 
| 29 | 
            +
                  date:
         | 
| 30 | 
            +
                  - Thu, 22 Dec 2011 15:15:50 GMT
         | 
| 31 | 
            +
                  content-length:
         | 
| 32 | 
            +
                  - '750'
         | 
| 33 | 
            +
                body: <ReportsList xmlns="http://www.concursolutions.com/api/expense/expensereport/2011/03"
         | 
| 34 | 
            +
                  xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><ReportSummary><ReportName>Fuel</ReportName><ReportId>AD63693E22DB4F65BA05</ReportId><ReportTotal>263.04000000</ReportTotal><ReportDate>2011-11-23T00:00:00</ReportDate><LastComment/><Report-Details-Url>https://www.concursolutions.com/api/expense/expensereport/v1.1/report/nABR4fUZDftz3veYYzMffJR5k3uLU7xQy</Report-Details-Url><Report-Full-Details-Url>https://www.concursolutions.com/api/expense/expensereport/v1.1/reportfulldetails/nABR4fUZDftz3veYYzMffJR5k3uLU7xQy</Report-Full-Details-Url><ExpenseUserXUserID>derek.kastner@brighterplanet.com</ExpenseUserXUserID><ApproverXUserID/></ReportSummary></ReportsList>
         | 
| 35 | 
            +
                http_version: '1.1'
         |