spyri-api 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spyri_api/invoices.rb +5 -6
- data/lib/spyri_api/subscriptions.rb +6 -7
- data/lib/spyri_api/users.rb +7 -8
- data/lib/spyri_api/version.rb +1 -1
- metadata +1 -2
- 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: 814cdd58f0095f4ee13a2620f11a16772e69b17ea7fb44351cb137a17d49d847
|
4
|
+
data.tar.gz: d319f88449d8a23d4de85381a7dbb0262ef33c6922978eefb010d4d9769807d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f13d6c99d3a6b86a3ee86e4dd4f4688b16e3bdd9600890d45aba46d7b5cd7c625e9c56271547b5dbd7a081c707ebf673219ffddae0e09bfe190b2e63ee2941b
|
7
|
+
data.tar.gz: c13bd4678dc229b6491b3bd4a9f9d6829b49dc77d5e14b24cdbc8cd7c1bcbaa41af23b08b320dc6ee4b4a19621077bad7dc7c437d040fd03e4741069fa7528d1
|
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,21 @@ 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 })
|
33
32
|
end
|
34
33
|
|
35
34
|
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,7 +1,7 @@
|
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pabois
|
@@ -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
|