spyri-api 0.1.0 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5555a66d22f3d689dbf782661c89edcbc6b15df460476d4d7d78265ff64ddd7
4
- data.tar.gz: 8ce1848cae2871ee384175e3c7e283aa0ab5c5b29d2f3fd265652a04961411e3
3
+ metadata.gz: e99acff211e898fa9ffde40e736795ff8e357b19dbec0fd7ad2367478d4d3d93
4
+ data.tar.gz: f3a7fdbd14a68c952d4de5f846d7287a1c54901a003749f4fde51b4f3d18ee5c
5
5
  SHA512:
6
- metadata.gz: 721e0f90724e9504cfd950b8da10fb8486364c6cf2d6842c7b85241169d28f737bb717cc1b9c8078828be43ddb34bbdd39b3cf50373844a0eedd3732b5d3afec
7
- data.tar.gz: fcc9dec7defab91c3996a0400ee60ef96db7296d355f7296636cff4785b339fe224b24fe3c6dcb9dcb8a862e4db3124d535a320be10d0f14d59a1cae1e8df8c9
6
+ metadata.gz: e5c24e5b5316625119881df9f80701c4d2465925a0ec83ec3da6692fa2ab5544636cab134921126b6e6ee5688716ce675b4b47fd80f1558f8cc720317e4b32ad
7
+ data.tar.gz: 46b578d1132ed5d2bd2554c662cb62719a22e51e12998bb1b10a54e508b8459a8b0d902c52c73b67689ec856e3b1661bd30ab18cedf76dbfbce67a4321488834
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [0.1.2] - 2024-12-04
2
+
3
+ - Add update and terminate methods to subscriptions
4
+
5
+ ## [0.1.1] - 2024-11-06
6
+
7
+ - Remove rails dependency
8
+
1
9
  ## [0.1.0] - 2024-11-06
2
10
 
3
11
  - Initial release
12
+
@@ -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
- [:code, :subscription_id, :user_id].each do |key|
17
- query_params[key.to_s] = opts[key] if !opts[key].blank?
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
- data = @api_client.call_api(:GET, path, query_params: query_params)
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
- data = @api_client.call_api(:GET, path)
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
- [:erp_id].each do |key|
17
- query_params[key.to_s] = opts[key] if !opts[key].blank?
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
- data = @api_client.call_api(:GET, path, query_params: query_params)
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
- data = @api_client.call_api(:GET, path)
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
- data = @api_client.call_api(:POST, path, body: { subscription: subscription_object })
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
@@ -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
- [:email, :name, :phone_number, :erp_id].each do |key|
17
- query_params[key.to_s] = opts[key] if !opts[key].blank?
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
- data = @api_client.call_api(:GET, path, query_params: query_params)
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
- data = @api_client.call_api(:GET, path)
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
- data = @api_client.call_api(:POST, path, body: { user: user_object })
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
- data = @api_client.call_api(:PATCH, path, body: { user: user_object })
36
+ @api_client.call_api(:PATCH, path, body: { user: user_object })
38
37
  end
39
38
 
40
39
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SpyriApi
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
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.0
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-06 00:00:00.000000000 Z
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