economic-rest 0.2.1 → 0.2.3

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
  SHA1:
3
- metadata.gz: 70dd914f6e7821a8c727eeb8d6f1bb3ccd5cb1ad
4
- data.tar.gz: 263b1e229629e472e794f4722942ae976e9dcbe5
3
+ metadata.gz: da6726b14829a14829abfe2c54c95ae5dbb933bc
4
+ data.tar.gz: 54c32651c44a9890285dbaba7b63b01ddbc7edf9
5
5
  SHA512:
6
- metadata.gz: 5f528aeceed253f32041d2e5acf86a88e7889f00634ff3798793621bba6a60e5f705cc51061062c411a343866f8a1acc24607343c1b8543484079ad4d541b9f1
7
- data.tar.gz: d91757bca5942f4c9f7b9613e85198d3cfee707633cc2bff1551707adffcd5a54211d2da67d462c4542c67462802a5cabef5afc47fa4c503e3701f669512bb1c
6
+ metadata.gz: 386543655abadcf0d1cdd49447c392551ba1d4f67a0fdfa59dbf0c17a4c9cca6d876b1b3f57052d7e9b1c84b98824a4cc4210c81204cc2e4cf11d204b7a76dd8
7
+ data.tar.gz: 90a11c953a388ab1149c36204039d2f195670a8b936a93a810d8277d7c932cf824f80cd39218c611e3cbeb35349ecf95b533b3a3e16bf1e27bad0a93f5455007
@@ -88,7 +88,7 @@ module Economic
88
88
  end_p = end_p.gsub('Repo', 's')
89
89
  end
90
90
  end_p = end_p.gsub('Journals', 'Journals-Experimental')
91
- end_p.downcase
91
+ kebab(end_p)
92
92
  end
93
93
 
94
94
  def endpoint_url
@@ -100,6 +100,14 @@ module Economic
100
100
 
101
101
  response
102
102
  end
103
+
104
+ def kebab(string)
105
+ string.gsub(/::/, '/')
106
+ .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
107
+ .gsub(/([a-z\d])([A-Z])/, '\1_\2')
108
+ .tr('_', '-')
109
+ .downcase
110
+ end
103
111
  end
104
112
  end
105
113
  end
@@ -1,5 +1,8 @@
1
1
  module Economic
2
2
  class ProductGroup < Base
3
- field :productGroupNumber
3
+ field :name
4
+ field :productGroupNumber, id: true
5
+ field :salesAccounts
6
+ field :products
4
7
  end
5
8
  end
@@ -0,0 +1,15 @@
1
+ module Economic
2
+ class ProductGroupRepo < Economic::BaseRepo
3
+ def self.find_products(entry_number)
4
+ end_point = [endpoint_url, entry_number, 'products'].join('/')
5
+ response = test_response(RestClient.get(end_point, headers))
6
+ entry_hash = JSON.parse(response.body)
7
+ products = []
8
+
9
+ entry_hash['collection'].each do |product|
10
+ products.push Product.new(product)
11
+ end
12
+ products
13
+ end
14
+ end
15
+ end
@@ -27,6 +27,7 @@ require 'economic/order'
27
27
  require 'economic/orders/archived_repo'
28
28
  require 'economic/orders/drafts_repo'
29
29
  require 'economic/orders/sent_repo'
30
+ require 'economic/product_group_repo'
30
31
 
31
32
  require 'economic/journal_repo'
32
33
  require 'economic/journal'
@@ -1,5 +1,5 @@
1
1
  module Economic
2
2
  module Rest
3
- VERSION = '0.2.1'.freeze
3
+ VERSION = '0.2.3'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: economic-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Klogborg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-27 00:00:00.000000000 Z
11
+ date: 2019-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -146,6 +146,7 @@ files:
146
146
  - lib/economic/pdf.rb
147
147
  - lib/economic/product.rb
148
148
  - lib/economic/product_group.rb
149
+ - lib/economic/product_group_repo.rb
149
150
  - lib/economic/product_repo.rb
150
151
  - lib/economic/project.rb
151
152
  - lib/economic/recipient.rb
@@ -175,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
176
  version: '0'
176
177
  requirements: []
177
178
  rubyforge_project:
178
- rubygems_version: 2.5.1
179
+ rubygems_version: 2.5.2.3
179
180
  signing_key:
180
181
  specification_version: 4
181
182
  summary: Ruby wrapper for the e-conomic REST API, that aims at making working with