queenbee 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8f8b3222dfd546ac5d3570508ae022ad620625e6
4
- data.tar.gz: 2c78a8f764858af2dc8e2403cd68b17b69c43c5d
2
+ SHA256:
3
+ metadata.gz: 700f919932c2e044a87eb17cfa2d49762f23ea32cff50281e451c187e2ee5486
4
+ data.tar.gz: de6374d95b7f7ecb379b7865fb3478f01fa77bbcbe62199c1424897c4d087e62
5
5
  SHA512:
6
- metadata.gz: 2aca9eee132dfa8fd36092761f9cb30a5c16e504fbbbd107d50d831ec3b3e26a0d656b62b3c37b94429458c2f7d76d05ede12252ea8e09180442b63731304652
7
- data.tar.gz: 074c1abe26c21d4debe0cced5c87c662587578bcf1ede5b8521a6060047a63be180c3bfa39e1768b765b9a7324b7984e397b088207e6e428371e3357eff86c67
6
+ metadata.gz: 3a4e357b94a3c451626c77aeb9695d4a731e35afa3350232a7948dc0af6285b9215bb139f5eab03f224ab5aef8dedf9178b70f03aed6d03efb2f2f69601bd4cc
7
+ data.tar.gz: 19b894534640542866bddb6a9d2cdfbd59bfd0b30a6acf93fc1b12a72774617ce10a3299e2b3657ab97463978a26fd1c6616f747c174aad90d9f8e302edfa2bc
@@ -1,5 +1,10 @@
1
1
  module Queenbee
2
2
  class Event < APIResource
3
+ extend Queenbee::APIOperations::Get
3
4
  include Queenbee::APIOperations::Create
5
+
6
+ def self.all(opts = {})
7
+ Queenbee::Metrics.get("/events?page=#{opts[:page] || 1}")
8
+ end
4
9
  end
5
10
  end
@@ -1,3 +1,3 @@
1
1
  module Queenbee
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -7,10 +7,22 @@ module Queenbee
7
7
  date: "2014-07-01 14:50:28",
8
8
  status: "confirmed",
9
9
  message: "From the API",
10
- metadata: {color: "pink", "sport": "basket-ball", "age": 25, "fruit": "banana"}
10
+ metadata: { color: "pink", "sport": "basket-ball", "age": 25, "fruit": "banana" }
11
11
  }
12
12
  end
13
13
 
14
+ should "index should return status 200" do
15
+ response = Queenbee::Event.all
16
+ assert_equal "200", response.code
17
+ assert_equal Array, JSON.parse(response.body).class
18
+ end
19
+
20
+ should "index should paginate" do
21
+ response = Queenbee::Event.all(page: 10)
22
+ assert_equal "200", response.code
23
+ assert_equal Array, JSON.parse(response.body).class
24
+ end
25
+
14
26
  should "create should return status 201" do
15
27
  response = Queenbee::Event.create(@valid_params)
16
28
  assert_equal "201", response.code
@@ -1,4 +1,5 @@
1
1
  require File.expand_path("../../test_helper", __FILE__)
2
+ require 'securerandom'
2
3
 
3
4
  module Queenbee
4
5
  class OrderTest < Test::Unit::TestCase
@@ -14,29 +15,35 @@ module Queenbee
14
15
  @updated_params = @valid_params.merge!(client_email: "kk@email.com")
15
16
  end
16
17
 
17
- # should "create should return status 201" do
18
- # response = Queenbee::Order.create(@valid_params)
19
- # assert_equal "201", response.code
20
- # end
18
+ should "create should return status 201" do
19
+ response = Queenbee::Order.create(@valid_params)
20
+ assert_equal "201", response.code
21
+ end
21
22
 
22
- # should "raise Queenbee::AuthenticationError if no token provided" do
23
- # Queenbee.token = nil
24
- # assert_raises(Queenbee::AuthenticationError) { Queenbee::Order.create }
25
- # end
23
+ should "raise Queenbee::AuthenticationError if no token provided" do
24
+ Queenbee.token = nil
25
+ assert_raises(Queenbee::AuthenticationError) { Queenbee::Order.create }
26
+ end
26
27
 
27
- # should "raise Queenbee::InvalidRequestError if not enough parameters" do
28
- # begin
29
- # rescue JSON::ParserError
30
- # assert_raises(Queenbee::InvalidRequestError) { Queenbee::Order.create }
31
- # end
32
- # end
28
+ should "raise Queenbee::InvalidRequestError if not enough parameters" do
29
+ begin
30
+ rescue JSON::ParserError
31
+ assert_raises(Queenbee::InvalidRequestError) { Queenbee::Order.create }
32
+ end
33
+ end
33
34
 
34
- # should "Update should return 200" do
35
- # response1 = Queenbee::Order.create(@valid_params)
36
- # response = Queenbee::Order.save(@updated_params)
37
- # assert_equal "200", response.code
38
- # end
35
+ should "Update should return 200" do
36
+ response1 = Queenbee::Order.create(@valid_params)
37
+ response = Queenbee::Order.save(@updated_params)
38
+ assert_equal "200", response.code
39
+ end
39
40
 
41
+ # Queenbee API raises error if record not found `find_by!`
42
+ # preventing tests from passing
43
+ # TODO
44
+ # - Review API response
45
+ # - Separate tests from real response from the API
46
+ #
40
47
  # should "Update should return 404 if UID incorrect" do
41
48
  # response1 = Queenbee::Order.create(@valid_params)
42
49
  # invalid_params = @valid_params.merge!(uid: "fakeuid")
@@ -54,6 +61,5 @@ module Queenbee
54
61
  # response = Queenbee::Order.delete("fakeuid")
55
62
  # assert_equal "404", response.code
56
63
  # end
57
-
58
64
  end
59
65
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: queenbee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olivier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-15 00:00:00.000000000 Z
11
+ date: 2018-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -128,12 +128,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  requirements: []
130
130
  rubyforge_project:
131
- rubygems_version: 2.6.11
131
+ rubygems_version: 2.7.6
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: Gem to send e-commerce orders to the Queenbee central app.
135
135
  test_files:
136
- - test/queenbee/event_test.rb
137
136
  - test/queenbee/metrics_test.rb
138
137
  - test/queenbee/order_test.rb
138
+ - test/queenbee/event_test.rb
139
139
  - test/test_helper.rb