pennylane 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -1
- data/Gemfile.lock +1 -1
- data/README.md +14 -1
- data/lib/pennylane/list_object.rb +1 -1
- data/lib/pennylane/object_types.rb +15 -0
- data/lib/pennylane/util.rb +1 -1
- data/lib/pennylane/version.rb +1 -1
- data/lib/pennylane.rb +2 -11
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d39d39c57d464e5c95acf6535e0e80508e9836fcbd8dd3afe49373283d965438
|
4
|
+
data.tar.gz: f4339e0fda690f67625aefb006f3964fdeefd8f125d9ff68ef26408cbb30caef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 745d583286f8eeb20da9acb324ae2b7b0e2ca9611537c4aa340d674ad8c380428ee337e03c70c823940e61748520c7b5a267fa09a34493af4a6234a7ebded501
|
7
|
+
data.tar.gz: 4e671e89e28b95717eb5a800c4463896349eadf5756a1ebb11a69a645391881bb51f247960d9f6bd6e118a3386542796cf6646defaf7baafaa36a4d6152a8fc3
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -16,9 +16,22 @@ Install the gem and add to the application's Gemfile by executing:
|
|
16
16
|
$ bundle add pennylane
|
17
17
|
|
18
18
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
19
|
+
```ruby
|
20
|
+
# Add to gemfile
|
21
|
+
gem 'pennylane'
|
22
|
+
```
|
19
23
|
|
20
|
-
|
24
|
+
For Rails app :
|
25
|
+
```ruby
|
26
|
+
# Create initializers/pennylane.rb
|
27
|
+
Pennylane.api_key = Rails.application.credentials.dig(:pennylane, :api_key)
|
21
28
|
|
29
|
+
# Add credentials to config/credentials.yml.enc
|
30
|
+
$ EDITOR=vim bin/rails credentials:edit
|
31
|
+
|
32
|
+
pennylane:
|
33
|
+
api_key: 'x0fd....'
|
34
|
+
```
|
22
35
|
## Requirements
|
23
36
|
Ruby 2.3+.
|
24
37
|
|
@@ -19,7 +19,7 @@ module Pennylane
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def key_for(resp)
|
22
|
-
resp.keys.find { |k| Pennylane::
|
22
|
+
resp.keys.find { |k| Pennylane::ObjectTypes.object_names_to_classes.keys.include?(Util.singularize(k.to_s)) } || resp.keys.find { |k| resp[k].is_a? Array }
|
23
23
|
end
|
24
24
|
|
25
25
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Pennylane
|
2
|
+
module ObjectTypes
|
3
|
+
def self.object_names_to_classes
|
4
|
+
{
|
5
|
+
ListObject.object_name => ListObject,
|
6
|
+
Category.object_name => Category,
|
7
|
+
CategoryGroup.object_name => CategoryGroup,
|
8
|
+
Customer.object_name => Customer,
|
9
|
+
CustomerInvoice.object_name => CustomerInvoice,
|
10
|
+
Product.object_name => Product,
|
11
|
+
Supplier.object_name => Supplier
|
12
|
+
}.freeze
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/pennylane/util.rb
CHANGED
data/lib/pennylane/version.rb
CHANGED
data/lib/pennylane.rb
CHANGED
@@ -11,8 +11,9 @@ require 'forwardable'
|
|
11
11
|
require 'uri'
|
12
12
|
require 'net/http'
|
13
13
|
|
14
|
-
Dir[
|
14
|
+
Dir[File.join(__dir__, 'pennylane/resources/*.rb')].each {|file| require file }
|
15
15
|
|
16
|
+
require 'pennylane/object_types'
|
16
17
|
|
17
18
|
module Pennylane
|
18
19
|
class Error < StandardError; end
|
@@ -20,16 +21,6 @@ module Pennylane
|
|
20
21
|
class ConfigurationError < Error; end
|
21
22
|
class NotFoundError < Error; end
|
22
23
|
|
23
|
-
API_RESOURCES = {
|
24
|
-
ListObject.object_name => ListObject,
|
25
|
-
Category.object_name => Category,
|
26
|
-
CategoryGroup.object_name => CategoryGroup,
|
27
|
-
Customer.object_name => Customer,
|
28
|
-
CustomerInvoice.object_name => CustomerInvoice,
|
29
|
-
Product.object_name => Product,
|
30
|
-
Supplier.object_name => Supplier
|
31
|
-
}.freeze
|
32
|
-
|
33
24
|
@config = Pennylane::Configuration.new
|
34
25
|
# So we can have a module Pennylane that can be a class as well Pennylane.api_key = '1234'
|
35
26
|
class << self
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pennylane
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephane Bounmy
|
@@ -87,6 +87,7 @@ files:
|
|
87
87
|
- lib/pennylane/configuration.rb
|
88
88
|
- lib/pennylane/list_object.rb
|
89
89
|
- lib/pennylane/object.rb
|
90
|
+
- lib/pennylane/object_types.rb
|
90
91
|
- lib/pennylane/resources/base.rb
|
91
92
|
- lib/pennylane/resources/category.rb
|
92
93
|
- lib/pennylane/resources/category_group.rb
|