spyri-api 0.1.0 → 0.1.1

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: 814cdd58f0095f4ee13a2620f11a16772e69b17ea7fb44351cb137a17d49d847
4
+ data.tar.gz: d319f88449d8a23d4de85381a7dbb0262ef33c6922978eefb010d4d9769807d5
5
5
  SHA512:
6
- metadata.gz: 721e0f90724e9504cfd950b8da10fb8486364c6cf2d6842c7b85241169d28f737bb717cc1b9c8078828be43ddb34bbdd39b3cf50373844a0eedd3732b5d3afec
7
- data.tar.gz: fcc9dec7defab91c3996a0400ee60ef96db7296d355f7296636cff4785b339fe224b24fe3c6dcb9dcb8a862e4db3124d535a320be10d0f14d59a1cae1e8df8c9
6
+ metadata.gz: 9f13d6c99d3a6b86a3ee86e4dd4f4688b16e3bdd9600890d45aba46d7b5cd7c625e9c56271547b5dbd7a081c707ebf673219ffddae0e09bfe190b2e63ee2941b
7
+ data.tar.gz: c13bd4678dc229b6491b3bd4a9f9d6829b49dc77d5e14b24cdbc8cd7c1bcbaa41af23b08b320dc6ee4b4a19621077bad7dc7c437d040fd03e4741069fa7528d1
@@ -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,21 @@ 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 })
33
32
  end
34
33
 
35
34
  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.1"
5
5
  end
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.0
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