poslavu 0.0.1 → 0.0.2

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.
@@ -0,0 +1,17 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 1.9.2
5
+ - jruby-18mode
6
+ - jruby-19mode
7
+ - rbx-18mode
8
+ - rbx-19mode
9
+ - ruby-head
10
+ - jruby-head
11
+ - 1.8.7
12
+ - ree
13
+ before_install:
14
+ - gem install nokogiri -- --with-cflags='--std=gnu99'
15
+ matrix:
16
+ allow_failures:
17
+ - rvm: jruby-head
data/Gemfile CHANGED
@@ -1,2 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
+
4
+ platforms :jruby do
5
+ gem "jruby-openssl"
6
+ end
@@ -1,5 +1,7 @@
1
1
  = POSLavu
2
2
 
3
+ {<img src="https://secure.travis-ci.org/willglynn/poslavu.png" alt="Build Status" />}[http://travis-ci.org/willglynn/poslavu] {<img src="https://gemnasium.com/willglynn/poslavu.png" alt="Dependency Status" />}[https://gemnasium.com/willglynn/poslavu]
4
+
3
5
  POSLavu[http://www.poslavu.com/] is a hosted point-of-sale system. They
4
6
  provide an API.
5
7
 
@@ -15,6 +17,17 @@ access methods.
15
17
 
16
18
  Naturally, you'll need a POSLavu account to do anything useful.
17
19
 
20
+ == Status
21
+
22
+ The gem works for basic API calls and querying. I had planned on adding a set
23
+ of ActiveModel-compliant objects on top, but the organization I built this for
24
+ is now giving up on POSLavu, citing stability issues and myriad other pain
25
+ points. As a result, I will not be developing this gem further.
26
+
27
+ If you're in a position where this gem will be helpful, by all means, use it.
28
+ If it breaks, by all means, fix it and send a pull request. If you'd like to
29
+ take over, let me know; I'm open.
30
+
18
31
  == Installation
19
32
 
20
33
  Add this line to your application's Gemfile:
@@ -1,4 +1,4 @@
1
1
  module POSLavu
2
2
  # The version of the POSLavu gem.
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
@@ -24,6 +24,30 @@ module POSLavu::APIStub
24
24
  end
25
25
 
26
26
  def have_requested_poslavu_api(params = {})
27
- have_requested(:post, POSLavu::Client::URL).with(:body => hash_including(params))
27
+ expected_filters = params.delete('filters')
28
+
29
+ have_requested(:post, POSLavu::Client::URL).with(:body => hash_including(params)) { |req|
30
+ if expected_filters
31
+ # filters is JSON, which needs to be an equivalent data structure
32
+ params = WebMock::Util::QueryMapper.query_to_values(req.body)
33
+
34
+ if actual_filters = params['filters']
35
+ # request has parameter
36
+ # parse both
37
+ expected = MultiJson.load(expected_filters).sort_by { |f| f['field'] }
38
+ actual = MultiJson.load(actual_filters).sort_by { |f| f['field'] }
39
+
40
+ # compare
41
+ expected == actual
42
+ else
43
+ # request missing parameter; fail
44
+ false
45
+ end
46
+
47
+ else
48
+ # no filters parameter; match
49
+ true
50
+ end
51
+ }
28
52
  end
29
53
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poslavu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-03 00:00:00.000000000 Z
12
+ date: 2012-10-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -180,6 +180,7 @@ extensions: []
180
180
  extra_rdoc_files: []
181
181
  files:
182
182
  - .gitignore
183
+ - .travis.yml
183
184
  - Gemfile
184
185
  - LICENSE
185
186
  - README.rdoc
@@ -221,7 +222,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
221
222
  version: '0'
222
223
  segments:
223
224
  - 0
224
- hash: -4247689874090540976
225
+ hash: -2567318414305325041
225
226
  required_rubygems_version: !ruby/object:Gem::Requirement
226
227
  none: false
227
228
  requirements:
@@ -230,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
230
231
  version: '0'
231
232
  segments:
232
233
  - 0
233
- hash: -4247689874090540976
234
+ hash: -2567318414305325041
234
235
  requirements: []
235
236
  rubyforge_project:
236
237
  rubygems_version: 1.8.24