queenbee 0.0.5 → 1.0.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
2
  SHA1:
3
- metadata.gz: aa104c36396a2ceb76794c4f2a0a4f7920ce9e23
4
- data.tar.gz: 0f1e895d2ff5f824dec9ce2d52cf2dc41621d521
3
+ metadata.gz: 8f8b3222dfd546ac5d3570508ae022ad620625e6
4
+ data.tar.gz: 2c78a8f764858af2dc8e2403cd68b17b69c43c5d
5
5
  SHA512:
6
- metadata.gz: afb9f6a416025fb21da26d85bd9c38bb72f31e98b3d2d412ff8e12cc3692e674f4cefda90ed86884acbe4795fb1d70f5b11cf0ba7d7540bf81a53d9c40f6c609
7
- data.tar.gz: bcb9e9e51a3bc4b986b364454d57a34bbc1d7c14e9ed1bcc83e6f83cd97a230426633d16e4d30e9f82c0676f059bf7156d5faad0966fc164e38a52850cb3950a
6
+ metadata.gz: 2aca9eee132dfa8fd36092761f9cb30a5c16e504fbbbd107d50d831ec3b3e26a0d656b62b3c37b94429458c2f7d76d05ede12252ea8e09180442b63731304652
7
+ data.tar.gz: 074c1abe26c21d4debe0cced5c87c662587578bcf1ede5b8521a6060047a63be180c3bfa39e1768b765b9a7324b7984e397b088207e6e428371e3357eff86c67
data/README.md CHANGED
@@ -28,7 +28,7 @@ In your app
28
28
  Queenbee.token = ENV['QUEENBEE_TOKEN']
29
29
  ```
30
30
 
31
- 2. Send order
31
+ 2. Send order/event
32
32
 
33
33
  ```ruby
34
34
  Queenbee::Order.create(
@@ -45,7 +45,7 @@ Queenbee::Order.create(
45
45
  )
46
46
  ```
47
47
 
48
- Optional attributes are avaiable for subscription-type such as:
48
+ Optional attributes are avaiable for subscription-type application such as:
49
49
 
50
50
  ```ruby
51
51
  subscribed_at: '2015-05-05 20:13:45',
@@ -78,6 +78,8 @@ rake test
78
78
 
79
79
  ## Complete list of parameters
80
80
 
81
+ ### Order
82
+
81
83
  - uid (string, must be unique per application)
82
84
  - date (datetime. default to record creation timestamp. Should be used to send historic data)
83
85
  - currency (string. i.e. 'CAD')
@@ -96,3 +98,10 @@ rake test
96
98
  - subscribed_at (datetime. For recurring order)
97
99
  - unsubscribed_at (datetime. For recurring order)
98
100
  - fees (decimal)
101
+
102
+ ### Event
103
+
104
+ - date (datetime. required. i.e. 2014-07-01 14:50:28)
105
+ - status: (string. required)
106
+ - message: (text. required)
107
+ - metadata: (hash. optional)
data/lib/queenbee.rb CHANGED
@@ -18,6 +18,7 @@ require "queenbee/api_operations/delete"
18
18
  # Resources
19
19
  require "queenbee/queenbee_object"
20
20
  require "queenbee/api_resource"
21
+ require "queenbee/event"
21
22
  require "queenbee/order"
22
23
  require "queenbee/metrics"
23
24
 
@@ -0,0 +1,5 @@
1
+ module Queenbee
2
+ class Event < APIResource
3
+ include Queenbee::APIOperations::Create
4
+ end
5
+ end
@@ -9,6 +9,5 @@ module Queenbee
9
9
  def self.all
10
10
  Queenbee::Metrics.get('/metrics/all')
11
11
  end
12
-
13
12
  end
14
13
  end
@@ -1,5 +1,4 @@
1
1
  module Queenbee
2
2
  class QueenbeeObject
3
-
4
3
  end
5
- end
4
+ end
@@ -1,3 +1,3 @@
1
1
  module Queenbee
2
- VERSION = "0.0.5"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -0,0 +1,31 @@
1
+ require File.expand_path("../../test_helper", __FILE__)
2
+
3
+ module Queenbee
4
+ class EventTest < Test::Unit::TestCase
5
+ setup do
6
+ @valid_params = {
7
+ date: "2014-07-01 14:50:28",
8
+ status: "confirmed",
9
+ message: "From the API",
10
+ metadata: {color: "pink", "sport": "basket-ball", "age": 25, "fruit": "banana"}
11
+ }
12
+ end
13
+
14
+ should "create should return status 201" do
15
+ response = Queenbee::Event.create(@valid_params)
16
+ assert_equal "201", response.code
17
+ end
18
+
19
+ should "raise Queenbee::AuthenticationError if no token provided" do
20
+ Queenbee.token = nil
21
+ assert_raises(Queenbee::AuthenticationError) { Queenbee::Event.create }
22
+ end
23
+
24
+ should "raise Queenbee::InvalidRequestError if not enough parameters" do
25
+ begin
26
+ rescue JSON::ParserError
27
+ assert_raises(Queenbee::InvalidRequestError) { Queenbee::Event.create }
28
+ end
29
+ end
30
+ end
31
+ end
data/test/test_helper.rb CHANGED
@@ -4,7 +4,7 @@ require 'shoulda'
4
4
 
5
5
  class Test::Unit::TestCase
6
6
  setup do
7
- Queenbee.api_base = 'http://localhost:3019/api'
7
+ Queenbee.api_base = 'http://localhost:3010/api'
8
8
  Queenbee.token = '111'
9
9
  end
10
10
 
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: 0.0.5
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olivier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-28 00:00:00.000000000 Z
11
+ date: 2017-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '3'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '3'
83
83
  description: E-commerce analytics platform
84
84
  email:
85
85
  - olivier@yafoy.com
@@ -99,10 +99,12 @@ files:
99
99
  - lib/queenbee/errors/authentication_error.rb
100
100
  - lib/queenbee/errors/invalid_request_error.rb
101
101
  - lib/queenbee/errors/queenbee_error.rb
102
+ - lib/queenbee/event.rb
102
103
  - lib/queenbee/metrics.rb
103
104
  - lib/queenbee/order.rb
104
105
  - lib/queenbee/queenbee_object.rb
105
106
  - lib/queenbee/version.rb
107
+ - test/queenbee/event_test.rb
106
108
  - test/queenbee/metrics_test.rb
107
109
  - test/queenbee/order_test.rb
108
110
  - test/test_helper.rb
@@ -126,11 +128,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
128
  version: '0'
127
129
  requirements: []
128
130
  rubyforge_project:
129
- rubygems_version: 2.4.3
131
+ rubygems_version: 2.6.11
130
132
  signing_key:
131
133
  specification_version: 4
132
134
  summary: Gem to send e-commerce orders to the Queenbee central app.
133
135
  test_files:
136
+ - test/queenbee/event_test.rb
134
137
  - test/queenbee/metrics_test.rb
135
138
  - test/queenbee/order_test.rb
136
139
  - test/test_helper.rb