agilix 0.6.0 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/agilix/buzz/api.rb +20 -20
- data/lib/agilix/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2574c48446db7d43f059d8600854fadc55481506e7fa8a1d2e67c7e5953c7245
|
4
|
+
data.tar.gz: fdde5ae592e333d8f29ee42416a6c8f16be8fbd1162044216a9b2442905d8625
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3546e5be858cc58b1b3d6d590a0886cda9848942b8cd605427b0ce40babb3b06cb38acf9acc831ca39bd8ed615b94b7414af54805b1fe49497390975bab632e7
|
7
|
+
data.tar.gz: 82621e6b177da329f00f6379c48eec1fad9143cd6acd64b246ff216b02c676543ceb3cdd91008f5c4d7798b8843d5dc41a2fd0536417025e78abbd81fb20047b
|
data/lib/agilix/buzz/api.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module Agilix
|
2
2
|
module Buzz
|
3
3
|
class Api
|
4
|
-
|
5
|
-
|
4
|
+
AGILIX_URL_ENDPOINT = ENV.fetch("AGILIX_BUZZ_URL", "https://api.schooldigger.com")
|
5
|
+
AGILIX_URL_BASE = "#{AGILIX_URL_ENDPOINT}/cmd"
|
6
6
|
include HTTParty
|
7
7
|
|
8
8
|
include Agilix::Buzz::Commands::Authentication
|
@@ -46,33 +46,33 @@ module Agilix
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def get(query = {})
|
49
|
-
response = self.class.get(
|
49
|
+
response = self.class.get(AGILIX_URL_BASE, query: modify_query(query), timeout: 60, headers: headers)
|
50
50
|
end
|
51
51
|
|
52
52
|
def post(query = {})
|
53
|
-
response = self.class.post(
|
53
|
+
response = self.class.post(AGILIX_URL_BASE, body: modify_body(query), timeout: 60, headers: headers)
|
54
54
|
end
|
55
55
|
|
56
56
|
# Not sure if I want to use this yet
|
57
57
|
# api.response_parser response: response, path_to_parse: ['response', 'users', 'user'], collection_name: 'users'
|
58
|
-
def response_parser(path_to_parse: nil, collection_name: nil, response: )
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
end
|
58
|
+
# def response_parser(path_to_parse: nil, collection_name: nil, response: )
|
59
|
+
# if path_to_parse
|
60
|
+
# result = response.dig(*path_to_parse)
|
61
|
+
# ostruct = JSON::parse({collection_name => result}.to_json, object_class: OpenStruct)
|
62
|
+
# ostruct.result_count = result.size
|
63
|
+
# ostruct.collection_name = collection_name
|
64
|
+
# else
|
65
|
+
# ostruct = JSON::parse(response.body, object_class: OpenStruct)
|
66
|
+
# end
|
67
|
+
# ostruct.code = response['code']
|
68
|
+
# ostruct.response = response
|
69
|
+
# ostruct.request = request
|
70
|
+
# ostruct
|
71
|
+
# end
|
72
72
|
|
73
73
|
# For when the api is super unconventional & you need to modify both query params & body params in a custom fashion, and upload a file even!
|
74
74
|
def query_post(query = {})
|
75
|
-
url =
|
75
|
+
url = AGILIX_URL_BASE
|
76
76
|
query_params = query.delete(:query_params)
|
77
77
|
if query_params
|
78
78
|
url += "?&_token=#{token}" + query_params.map {|k,v| "&#{k}=#{v}" }.join("")
|
@@ -89,7 +89,7 @@ module Agilix
|
|
89
89
|
|
90
90
|
def bulk_post(query = {})
|
91
91
|
cmd = query.delete(:cmd)
|
92
|
-
url =
|
92
|
+
url = AGILIX_URL_BASE + "?cmd=#{cmd}&_token=#{token}"
|
93
93
|
query_params = query.delete(:query_params)
|
94
94
|
if query_params
|
95
95
|
url += query_params.map {|k,v| "&#{k}=#{v}" }.join("")
|
data/lib/agilix/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agilix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Eggett
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -216,8 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
216
216
|
- !ruby/object:Gem::Version
|
217
217
|
version: '0'
|
218
218
|
requirements: []
|
219
|
-
|
220
|
-
rubygems_version: 2.7.8
|
219
|
+
rubygems_version: 3.0.3
|
221
220
|
signing_key:
|
222
221
|
specification_version: 4
|
223
222
|
summary: Agilix Buzz API wrapper
|