unloq 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
- data/lib/unloq/achievements.rb +2 -2
- data/lib/unloq/client.rb +4 -4
- data/lib/unloq/entity.rb +4 -0
- data/lib/unloq/events.rb +4 -4
- data/lib/unloq/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 484a542107975d1eddde65b5457ddaa4c90d5be8
|
4
|
+
data.tar.gz: 845a68b9301f4d9163368097bfa5a98e4dcdc2c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98c959380035e40cbd043e3d12840061e713b22c859885f7ff293d7a56bd126a3729dcec9b6be33dff47ffc8bfa06fd30940801dae584be6b67cb74c67d060b6
|
7
|
+
data.tar.gz: 22fb4a91441992cd467335ed60c15a64a45754800ec4616d3b9bec53ddd4b196e0236376eee35fce3f636c58dad99e1eb7b384b7b92b8185836cbee6eb7a96fe
|
data/lib/unloq/achievements.rb
CHANGED
@@ -3,8 +3,8 @@ module Unloq
|
|
3
3
|
|
4
4
|
# Create an achievement via the Unloq API
|
5
5
|
#
|
6
|
-
# @param verb [String]
|
7
|
-
# @param observation_count [Integer]
|
6
|
+
# @param verb [String] The verb for which this achievement should be unlocked
|
7
|
+
# @param observation_count [Integer] The number of times the event must occur to unlock this achievement
|
8
8
|
# @param author [Unloq::Entity] An individual author, if passed this achievement will only be attainable by this author. Required if author_type is not defined.
|
9
9
|
# @param recipient [Unloq::Entity] An individual recipient that must be acted on to attain this achievement. Required if recipient_type is not defined.
|
10
10
|
# @param author_type [String] An individual author type, if passed this achievement will only be attaintable by authors of this type. Required if author is not defined.
|
data/lib/unloq/client.rb
CHANGED
@@ -8,8 +8,8 @@ module Unloq
|
|
8
8
|
|
9
9
|
# Initialize the client class that will be used for all Unloq interactions.
|
10
10
|
#
|
11
|
-
# @param [String]
|
12
|
-
# @param [String]
|
11
|
+
# @param api_key [String] Your Unloq api key.
|
12
|
+
# @param namespace [String] The namespace under which Unloq events should be created, e.g. appname-dev
|
13
13
|
|
14
14
|
def initialize api_key: nil, namespace: nil
|
15
15
|
unless api_key && namespace
|
@@ -22,8 +22,8 @@ module Unloq
|
|
22
22
|
|
23
23
|
# Make a post request to the Unloq API
|
24
24
|
#
|
25
|
-
# @param [String]
|
26
|
-
# @param [Hash]
|
25
|
+
# @param endpoint [String] The resource endpoint, e.g. /events
|
26
|
+
# @param body [Hash] The body payload that should be POSTed
|
27
27
|
|
28
28
|
def post endpoint, body = {}
|
29
29
|
body.merge!(api_key: api_key, namespace: namespace)
|
data/lib/unloq/entity.rb
CHANGED
@@ -2,6 +2,10 @@ module Unloq
|
|
2
2
|
class Entity
|
3
3
|
attr_reader :id, :type, :meta
|
4
4
|
|
5
|
+
# Initialize an instance of an unloq entity. This has subclasses for Author and Recipient for ease of understanding.
|
6
|
+
# @param id [String] The ID of the entity (may also be an integer), e.g. 1 or '1'
|
7
|
+
# @param type [String] The type of the entity, e.g. 'User'
|
8
|
+
|
5
9
|
def initialize id: nil, type: nil, meta: {}
|
6
10
|
unless id && type
|
7
11
|
raise ArgumentError.new("You must include both an id and a type, e.g. #{self.class.to_s}.new(id: 1, type: 'User')")
|
data/lib/unloq/events.rb
CHANGED
@@ -3,10 +3,10 @@ module Unloq
|
|
3
3
|
|
4
4
|
# Create an event via the Unloq API
|
5
5
|
#
|
6
|
-
# @param [Unloq::Entity]
|
7
|
-
# @param [String]
|
8
|
-
# @param [Unloq::Entity]
|
9
|
-
# @param [Hash]
|
6
|
+
# @param author [Unloq::Entity] Author involved in the event
|
7
|
+
# @param verb [String] The verb of the event
|
8
|
+
# @param recipient [Unloq::Entity] Recipient involved in the event
|
9
|
+
# @param meta [Hash] A hash of additional metadata to send with the request
|
10
10
|
|
11
11
|
def create_event author, verb, recipient, meta = {}
|
12
12
|
validate_author(author)
|
data/lib/unloq/version.rb
CHANGED