orbit_activities 0.1.0 → 0.2.0
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/Gemfile.lock +3 -3
- data/README.md +94 -8
- data/lib/orbit_activities/request.rb +28 -7
- data/lib/orbit_activities/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc7987f3c248aecbec3b6b47dcaf336c1d6b6f8c1b3a838872d7ce1fd367fd99
|
4
|
+
data.tar.gz: ce386dea706f1688f01976a9a3220abe5d0ef99fc3252c6bf84924e0e58bfb34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b7c06e77cec507d664161d276991f8ccac407379cd13ed1541211c3ae26fd40aec63b4c45075cdab9cc5b8c9c7d5517040905c25188d4b2c6c714ed2ec9abc4
|
7
|
+
data.tar.gz: 0035ee2a73747bf6080e6004efed8ff04cf5b69f93cdb0ba55ca525ceffb76340a45a8eb6caece61df1bf99c760d8dc546157f9e01cd8206dbc30f5ed41c4d02
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
orbit_activities (0.0
|
4
|
+
orbit_activities (0.1.0)
|
5
5
|
http (~> 4.4)
|
6
6
|
json (~> 2.5)
|
7
7
|
rake (~> 13.0)
|
@@ -19,7 +19,7 @@ GEM
|
|
19
19
|
diff-lcs (1.4.4)
|
20
20
|
domain_name (0.5.20190701)
|
21
21
|
unf (>= 0.0.5, < 1.0.0)
|
22
|
-
ffi (1.15.
|
22
|
+
ffi (1.15.3)
|
23
23
|
ffi-compiler (1.0.1)
|
24
24
|
ffi (>= 1.0.0)
|
25
25
|
rake
|
@@ -29,7 +29,7 @@ GEM
|
|
29
29
|
http-cookie (~> 1.0)
|
30
30
|
http-form_data (~> 2.2)
|
31
31
|
http-parser (~> 1.2.0)
|
32
|
-
http-cookie (1.0.
|
32
|
+
http-cookie (1.0.4)
|
33
33
|
domain_name (~> 0.5)
|
34
34
|
http-form_data (2.3.0)
|
35
35
|
http-parser (1.2.3)
|
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
# Orbit
|
1
|
+
# Orbit Activities Helper Library for Ruby
|
2
2
|
|
3
3
|

|
4
4
|
[](https://badge.fury.io/rb/orbit_activities)
|
5
5
|
[](code_of_conduct.md)
|
6
6
|
|
7
|
-
>
|
7
|
+
> Orbit API helper library for Ruby. <br>This client can create, read, update and delete activities in your Orbit workspace.
|
8
8
|
|
9
|
-
<
|
9
|
+
<img src="https://github.com/orbit-love/js-orbit-activities/blob/bc4ce38a34af95e40b2c3e54ba44d3df6b3d3aac/.github/logo.png" alt="Orbit" style="max-width: 300px; margin: 2em 0;">
|
10
10
|
|
11
11
|
## Package Usage
|
12
12
|
|
@@ -20,19 +20,105 @@ gem "orbit_activities"
|
|
20
20
|
|
21
21
|
Then, run `bundle install` from your terminal.
|
22
22
|
|
23
|
-
###
|
23
|
+
### Usage
|
24
24
|
|
25
|
-
|
25
|
+
#### Create an Activity
|
26
|
+
|
27
|
+
To create an activity:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
OrbitActivities::Request.new(
|
31
|
+
api_key: # Your Orbit API key,
|
32
|
+
workspace_id: # Your Orbit workspace ID,
|
33
|
+
action: "new_activity",
|
34
|
+
body: # The custom activity object in JSON format, see Orbit API docs for reference
|
35
|
+
)
|
36
|
+
```
|
37
|
+
|
38
|
+
You can inspect the Orbit API response by appending `.response` to the end of the initialization method.
|
39
|
+
#### Update an Activity
|
40
|
+
|
41
|
+
To update an activity:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
OrbitActivities::Request.new(
|
45
|
+
api_key: # Your Orbit API key,
|
46
|
+
workspace_id: # Your Orbit workspace ID,
|
47
|
+
action: "update_activity",
|
48
|
+
activity_id: # The ID of the activity to be updated,
|
49
|
+
member_id: # The ID of the member the activity is attached to,
|
50
|
+
body: # The custom activity object in JSON format, see Orbit API docs for reference
|
51
|
+
)
|
52
|
+
```
|
53
|
+
|
54
|
+
You can inspect the Orbit API response by appending `.response` to the end of the initialization method.
|
55
|
+
#### Delete an Activity
|
56
|
+
|
57
|
+
To delete an activity:
|
26
58
|
|
27
59
|
```ruby
|
28
60
|
OrbitActivities::Request.new(
|
29
61
|
api_key: # Your Orbit API key,
|
30
62
|
workspace_id: # Your Orbit workspace ID,
|
31
|
-
|
63
|
+
action: "delete_activity",
|
64
|
+
activity_id: # The ID of the activity to be updated,
|
65
|
+
member_id: # The ID of the member the activity is attached to
|
32
66
|
)
|
33
67
|
```
|
34
68
|
|
35
|
-
|
69
|
+
You can inspect the Orbit API response by appending `.response` to the end of the initialization method.
|
70
|
+
#### List Activities
|
71
|
+
|
72
|
+
To list activities:
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
OrbitActivities::Request.new(
|
76
|
+
api_key: # Your Orbit API key,
|
77
|
+
workspace_id: # Your Orbit workspace ID,
|
78
|
+
action: "list_activities",
|
79
|
+
filters: # Any filters on the request in JSON format, see Orbit API docs for reference
|
80
|
+
).response
|
81
|
+
```
|
82
|
+
#### Get Specific Activity
|
83
|
+
|
84
|
+
To get a specific activity:
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
OrbitActivities::Request.new(
|
88
|
+
api_key: # Your Orbit API key,
|
89
|
+
workspace_id: # Your Orbit workspace ID,
|
90
|
+
action: "get_activity",
|
91
|
+
activity_id: # The ID of the actiivity
|
92
|
+
).response
|
93
|
+
```
|
94
|
+
#### Get Member Activities
|
95
|
+
|
96
|
+
To get activities associated with a specific member:
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
OrbitActivities::Request.new(
|
100
|
+
api_key: # Your Orbit API key,
|
101
|
+
workspace_id: # Your Orbit workspace ID,
|
102
|
+
action: "list_member_activities",
|
103
|
+
activity_id: # The ID of the actiivity,
|
104
|
+
member_id: # The ID of the member,
|
105
|
+
filters: # Any filters on the request in JSON format, see Orbit API docs for reference
|
106
|
+
).response
|
107
|
+
```
|
108
|
+
#### Get Latest Activity Timestamp for Activity Type
|
109
|
+
|
110
|
+
To get the latest activity timestamp for a specific activity type:
|
111
|
+
|
112
|
+
```ruby
|
113
|
+
OrbitActivities::Request.new(
|
114
|
+
api_key: # Your Orbit API key,
|
115
|
+
workspace_id: # Your Orbit workspace ID,
|
116
|
+
action: "latest_activity_timestamp",
|
117
|
+
filters: { activity_type: # Activity type to search for, e.g. "custom:linkedin:comment" }
|
118
|
+
).response
|
119
|
+
```
|
120
|
+
|
121
|
+
For details on the data structures the Orbit API expects, refer to the [Orbit API Documentation](https://docs.orbit.love/reference).
|
36
122
|
|
37
123
|
## Contributing
|
38
124
|
|
@@ -44,4 +130,4 @@ This is available as open source under the terms of the [MIT License](LICENSE).
|
|
44
130
|
|
45
131
|
## Code of Conduct
|
46
132
|
|
47
|
-
This project uses the [Contributor Code of Conduct](CODE_OF_CONDUCT.md). We ask everyone to please adhere by its guidelines.
|
133
|
+
This project uses the [Contributor Code of Conduct](CODE_OF_CONDUCT.md). We ask everyone to please adhere by its guidelines.
|
@@ -5,6 +5,7 @@ require_relative "http"
|
|
5
5
|
module OrbitActivities
|
6
6
|
class Request
|
7
7
|
attr_reader :api_key, :workspace_id, :user_agent, :action, :body, :filters, :member_id, :activity_id
|
8
|
+
attr_accessor :response
|
8
9
|
|
9
10
|
def initialize(params = {})
|
10
11
|
@action = params.fetch(:action)
|
@@ -15,6 +16,7 @@ module OrbitActivities
|
|
15
16
|
@filters = params.fetch(:filters, nil)
|
16
17
|
@member_id = params.fetch(:member_id, nil)
|
17
18
|
@activity_id = params.fetch(:activity_id, nil)
|
19
|
+
@response = nil
|
18
20
|
|
19
21
|
after_initialize!
|
20
22
|
end
|
@@ -35,6 +37,8 @@ module OrbitActivities
|
|
35
37
|
delete_post
|
36
38
|
when "update_activity"
|
37
39
|
update_activity
|
40
|
+
when "latest_activity_timestamp"
|
41
|
+
latest_activity_timestamp
|
38
42
|
else
|
39
43
|
raise ArgumentError,
|
40
44
|
"Activity type is unrecognized. Must be one of: new_activity, list_activities, get_activity, list_member_activities, create_post, delete_post, update_activity"
|
@@ -42,7 +46,7 @@ module OrbitActivities
|
|
42
46
|
end
|
43
47
|
|
44
48
|
def new_activity
|
45
|
-
OrbitActivities::HTTP.post(
|
49
|
+
@response = OrbitActivities::HTTP.post(
|
46
50
|
url: "https://app.orbit.love/api/v1/#{@workspace_id}/activities",
|
47
51
|
user_agent: @user_agent,
|
48
52
|
api_key: @api_key,
|
@@ -51,7 +55,7 @@ module OrbitActivities
|
|
51
55
|
end
|
52
56
|
|
53
57
|
def list_activities
|
54
|
-
OrbitActivities::HTTP.get(
|
58
|
+
@response = OrbitActivities::HTTP.get(
|
55
59
|
url: "https://app.orbit.love/api/v1/#{@workspace_id}/activities",
|
56
60
|
user_agent: @user_agent,
|
57
61
|
api_key: @api_key,
|
@@ -59,8 +63,25 @@ module OrbitActivities
|
|
59
63
|
)
|
60
64
|
end
|
61
65
|
|
66
|
+
def latest_activity_timestamp
|
67
|
+
filters = {
|
68
|
+
items: 10,
|
69
|
+
direction: "DESC"
|
70
|
+
}
|
71
|
+
filters.merge!(@filters)
|
72
|
+
|
73
|
+
response = OrbitActivities::HTTP.get(
|
74
|
+
url: "https://app.orbit.love/api/v1/#{@workspace_id}/activities",
|
75
|
+
user_agent: @user_agent,
|
76
|
+
api_key: @api_key,
|
77
|
+
filters: filters
|
78
|
+
)
|
79
|
+
|
80
|
+
@response = response["data"][0]["attributes"]["created_at"]
|
81
|
+
end
|
82
|
+
|
62
83
|
def get_activity
|
63
|
-
OrbitActivities::HTTP.get(
|
84
|
+
@response = OrbitActivities::HTTP.get(
|
64
85
|
url: "https://app.orbit.love/api/v1/#{@workspace_id}/activities/#{@activity_id}",
|
65
86
|
user_agent: @user_agent,
|
66
87
|
api_key: @api_key
|
@@ -68,7 +89,7 @@ module OrbitActivities
|
|
68
89
|
end
|
69
90
|
|
70
91
|
def list_member_activities
|
71
|
-
OrbitActivities::HTTP.get(
|
92
|
+
@response = OrbitActivities::HTTP.get(
|
72
93
|
url: "https://app.orbit.love/api/v1/#{@workspace_id}/members/#{@member_id}/activities",
|
73
94
|
user_agent: @user_agent,
|
74
95
|
api_key: @api_key,
|
@@ -77,7 +98,7 @@ module OrbitActivities
|
|
77
98
|
end
|
78
99
|
|
79
100
|
def create_post
|
80
|
-
OrbitActivities::HTTP.post(
|
101
|
+
@response = OrbitActivities::HTTP.post(
|
81
102
|
url: "https://app.orbit.love/api/v1/#{@workspace_id}/members/#{@member_id}/activities",
|
82
103
|
user_agent: @user_agent,
|
83
104
|
api_key: @api_key,
|
@@ -86,7 +107,7 @@ module OrbitActivities
|
|
86
107
|
end
|
87
108
|
|
88
109
|
def delete_post
|
89
|
-
OrbitActivities::HTTP.delete(
|
110
|
+
@response = OrbitActivities::HTTP.delete(
|
90
111
|
url: "https://app.orbit.love/api/v1/#{@workspace_id}/members/#{@member_id}/activities/#{@activity_id}",
|
91
112
|
user_agent: @user_agent,
|
92
113
|
api_key: @api_key
|
@@ -94,7 +115,7 @@ module OrbitActivities
|
|
94
115
|
end
|
95
116
|
|
96
117
|
def update_activity
|
97
|
-
OrbitActivities::HTTP.put(
|
118
|
+
@response = OrbitActivities::HTTP.put(
|
98
119
|
url: "https://app.orbit.love/api/v1/#{@workspace_id}/members/#{@member_id}/activities/#{@activity_id}",
|
99
120
|
user_agent: @user_agent,
|
100
121
|
api_key: @api_key,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orbit_activities
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Orbit DevRel
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-06-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: http
|