spyri-api 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/spyri_api/invoices.rb +5 -6
- data/lib/spyri_api/subscriptions.rb +16 -7
- data/lib/spyri_api/users.rb +7 -8
- data/lib/spyri_api/version.rb +1 -1
- metadata +2 -3
- data/.DS_Store +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e99acff211e898fa9ffde40e736795ff8e357b19dbec0fd7ad2367478d4d3d93
|
4
|
+
data.tar.gz: f3a7fdbd14a68c952d4de5f846d7287a1c54901a003749f4fde51b4f3d18ee5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5c24e5b5316625119881df9f80701c4d2465925a0ec83ec3da6692fa2ab5544636cab134921126b6e6ee5688716ce675b4b47fd80f1558f8cc720317e4b32ad
|
7
|
+
data.tar.gz: 46b578d1132ed5d2bd2554c662cb62719a22e51e12998bb1b10a54e508b8459a8b0d902c52c73b67689ec856e3b1661bd30ab18cedf76dbfbce67a4321488834
|
data/CHANGELOG.md
CHANGED
data/lib/spyri_api/invoices.rb
CHANGED
@@ -4,6 +4,7 @@ module SpyriApi
|
|
4
4
|
class Invoices
|
5
5
|
|
6
6
|
BASEPATH = '/invoices'.freeze
|
7
|
+
SEARCHABLE_ATTRIBUTES = [:code, :subscription_id, :user_id].freeze
|
7
8
|
|
8
9
|
attr_accessor :api_client
|
9
10
|
|
@@ -13,18 +14,16 @@ module SpyriApi
|
|
13
14
|
|
14
15
|
def search(opts = {})
|
15
16
|
query_params = {}
|
16
|
-
|
17
|
-
query_params[key.to_s] = opts[key] if !opts[key].
|
17
|
+
SEARCHABLE_ATTRIBUTES.each do |key|
|
18
|
+
query_params[key.to_s] = opts[key] if !opts[key].nil?
|
18
19
|
end
|
19
20
|
path = BASEPATH
|
20
|
-
|
21
|
-
return data
|
21
|
+
@api_client.call_api(:GET, path, query_params: query_params)
|
22
22
|
end
|
23
23
|
|
24
24
|
def get(id)
|
25
25
|
path = "#{BASEPATH}/#{id}"
|
26
|
-
|
27
|
-
return data
|
26
|
+
@api_client.call_api(:GET, path)
|
28
27
|
end
|
29
28
|
|
30
29
|
end
|
@@ -4,6 +4,7 @@ module SpyriApi
|
|
4
4
|
class Subscriptions
|
5
5
|
|
6
6
|
BASEPATH = '/subscriptions'.freeze
|
7
|
+
SEARCHABLE_ATTRIBUTES = [:erp_id].freeze
|
7
8
|
|
8
9
|
attr_accessor :api_client
|
9
10
|
|
@@ -13,23 +14,31 @@ module SpyriApi
|
|
13
14
|
|
14
15
|
def search(opts = {})
|
15
16
|
query_params = {}
|
16
|
-
|
17
|
-
query_params[key.to_s] = opts[key] if !opts[key].
|
17
|
+
SEARCHABLE_ATTRIBUTES.each do |key|
|
18
|
+
query_params[key.to_s] = opts[key] if !opts[key].nil?
|
18
19
|
end
|
19
20
|
path = BASEPATH
|
20
|
-
|
21
|
-
return data
|
21
|
+
@api_client.call_api(:GET, path, query_params: query_params)
|
22
22
|
end
|
23
23
|
|
24
24
|
def get(id)
|
25
25
|
path = "#{BASEPATH}/#{id}"
|
26
|
-
|
27
|
-
return data
|
26
|
+
@api_client.call_api(:GET, path)
|
28
27
|
end
|
29
28
|
|
30
29
|
def create(subscription_object)
|
31
30
|
path = BASEPATH
|
32
|
-
|
31
|
+
@api_client.call_api(:POST, path, body: { subscription: subscription_object })
|
32
|
+
end
|
33
|
+
|
34
|
+
def update(id, subscription_object)
|
35
|
+
path = "#{BASEPATH}/#{id}"
|
36
|
+
@api_client.call_api(:PATCH, path, body: { subscription: subscription_object })
|
37
|
+
end
|
38
|
+
|
39
|
+
def terminate(id)
|
40
|
+
path = "#{BASEPATH}/#{id}/terminate"
|
41
|
+
@api_client.call_api(:PATCH, path)
|
33
42
|
end
|
34
43
|
|
35
44
|
end
|
data/lib/spyri_api/users.rb
CHANGED
@@ -4,6 +4,7 @@ module SpyriApi
|
|
4
4
|
class Users
|
5
5
|
|
6
6
|
BASEPATH = '/users'.freeze
|
7
|
+
SEARCHABLE_ATTRIBUTES = [:email, :name, :phone_number, :erp_id].freeze
|
7
8
|
|
8
9
|
attr_accessor :api_client
|
9
10
|
|
@@ -13,28 +14,26 @@ module SpyriApi
|
|
13
14
|
|
14
15
|
def search(opts = {})
|
15
16
|
query_params = {}
|
16
|
-
|
17
|
-
query_params[key.to_s] = opts[key] if !opts[key].
|
17
|
+
SEARCHABLE_ATTRIBUTES.each do |key|
|
18
|
+
query_params[key.to_s] = opts[key] if !opts[key].nil?
|
18
19
|
end
|
19
20
|
path = BASEPATH
|
20
|
-
|
21
|
-
return data
|
21
|
+
@api_client.call_api(:GET, path, query_params: query_params)
|
22
22
|
end
|
23
23
|
|
24
24
|
def get(id)
|
25
25
|
path = "#{BASEPATH}/#{id}"
|
26
|
-
|
27
|
-
return data
|
26
|
+
@api_client.call_api(:GET, path)
|
28
27
|
end
|
29
28
|
|
30
29
|
def create(user_object)
|
31
30
|
path = BASEPATH
|
32
|
-
|
31
|
+
@api_client.call_api(:POST, path, body: { user: user_object })
|
33
32
|
end
|
34
33
|
|
35
34
|
def update(id, user_object)
|
36
35
|
path = "#{BASEPATH}/#{id}"
|
37
|
-
|
36
|
+
@api_client.call_api(:PATCH, path, body: { user: user_object })
|
38
37
|
end
|
39
38
|
|
40
39
|
end
|
data/lib/spyri_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spyri-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pabois
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -31,7 +31,6 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
-
- ".DS_Store"
|
35
34
|
- ".rspec"
|
36
35
|
- ".rubocop.yml"
|
37
36
|
- CHANGELOG.md
|
data/.DS_Store
DELETED
Binary file
|