ruby-booker 0.0.0 → 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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/booker.rb +41 -4
  3. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 858104afad5e09050a26b6f5ddc81d07714b1043
4
- data.tar.gz: 1782ac3d23539dc650a508a13547a389378eb5fa
3
+ metadata.gz: ec90e826113d2e34908cc340e182ae4b96d12cb3
4
+ data.tar.gz: 48ebb56deab1a9f34f7fa04ec38f1f9a49e88552
5
5
  SHA512:
6
- metadata.gz: 05b073a629714e3df981d9f8c91da7332ce1b1ad00e6063bdb5013ceac86d223e8ede8b9fe9a2edbf8be9a184b63341fb8da5774809f8ab40707adc1ea913967
7
- data.tar.gz: d57ccfdaee9583d95f7b069b4e87656dc0491cfb6f6ec7ceed7dec65b77af0f377d7282df2ef3da9d0e5bec22e7f24d884d42c57fb4ac6c5afafa5512a9463b8
6
+ metadata.gz: 0af2dcfe310f6b9303b2711b8c9694ba6c2b419b22e0ef5e33076c97ea2490f8d63c4af3cb36bced830227ad4697d2ad3fbcdca8af18dbfec409ed7cde0a47ed
7
+ data.tar.gz: 2dc84a0463ea84f885a84a47e11d91093156d763ee33524ba1b34bf52b1938f839bcecf5a5c1285e84f40885030bfc5eb2fb238e043dfb15c1df55a63fcd3619
@@ -13,6 +13,42 @@ module Booker
13
13
  set_access_token
14
14
  end
15
15
 
16
+ # Useful to pull all of paged results and return them as if you did one
17
+ # request for them all
18
+ #
19
+ # ex: client.all(:find_locations, 'Results')
20
+ def all method, result_name, options = {}
21
+ page_number = 1
22
+ results = []
23
+
24
+ # this allows page size to be overidden but NOT page_number as I want to
25
+ # control that to know when we have all results
26
+ options = {"PageSize" => 500}.merge options
27
+
28
+ begin
29
+ options.merge!({
30
+ "PageNumber" => page_number,
31
+ })
32
+
33
+ last_result = self.send(method, options)
34
+
35
+ results << last_result[result_name]
36
+ results.flatten!
37
+
38
+ if last_result['TotalResultsCount']
39
+ total_results = last_result['TotalResultsCount']
40
+ else
41
+ total_results = 0
42
+ end
43
+
44
+ page_number+=1
45
+ end while results.length < total_results-1
46
+
47
+ last_result.merge({
48
+ result_name => results
49
+ })
50
+ end
51
+
16
52
  #http://apidoc.booker.com/Method/Detail/129
17
53
  def run_multi_service_availability options = {}
18
54
  raise Booker::ArgumentError, 'Itineraries is required' unless options['Itineraries']
@@ -51,7 +87,7 @@ module Booker
51
87
  "EmployeeID" => nil,
52
88
  "LocationID" => nil,
53
89
  "PageNumber" => 1,
54
- "PageSize" => 10,
90
+ "PageSize" => 100,
55
91
  "SortBy" => [
56
92
  {
57
93
  "SortBy" => "Name",
@@ -72,7 +108,9 @@ module Booker
72
108
  url = build_url "/locations"
73
109
  defaults = {
74
110
  "access_token" => @access_token,
75
- "BusinessTypeId" => nil,
111
+ "BrandID" => nil,
112
+ "BusinessName" => nil,
113
+ "FeatureLevel" => nil,
76
114
  "PageNumber" => 1,
77
115
  "PageSize" => 5,
78
116
  "SortBy" => [
@@ -81,8 +119,7 @@ module Booker
81
119
  "SortDirection" => 0
82
120
  }
83
121
  ],
84
- #"UsePaging" => true, # throws a weird exception about null arguments
85
- "Name" => nil
122
+ "UsePaging" => true, # throws a weird exception about null arguments
86
123
  }
87
124
  return_post_response url, defaults, options
88
125
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-booker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Craige
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-03 00:00:00.000000000 Z
11
+ date: 2014-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -38,15 +38,15 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: Interact with booker api in rails
41
+ description: Interact with booker api through Ruby
42
42
  email: jake@poeticsystems.com
43
43
  executables: []
44
44
  extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
- - lib/ruby-booker.rb
48
47
  - LICENSE
49
48
  - lib/booker.rb
49
+ - lib/ruby-booker.rb
50
50
  homepage: http://rubygems.org/gems/ruby-booker
51
51
  licenses:
52
52
  - MIT
@@ -67,8 +67,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  version: '0'
68
68
  requirements: []
69
69
  rubyforge_project:
70
- rubygems_version: 2.0.3
70
+ rubygems_version: 2.2.1
71
71
  signing_key:
72
72
  specification_version: 4
73
- summary: Interact with booker api
73
+ summary: Ruby querying of Booker API
74
74
  test_files: []