bling_api 0.1.4 → 0.1.6

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: cb3194fb22e5d52dbca204cdf66c625e49bd7aa8ace5d5d92a467e29132a7e0f
4
- data.tar.gz: 3276b6d0c5a833169f2993bfaa204b12a566929d7fca61f31ab6f04deaa45dc5
3
+ metadata.gz: 205aa615619dae0b7e3d4ffc084e5cc353e52b22b8c8df6da36f50f2638fd816
4
+ data.tar.gz: 8f9918c4f1251e6ce4c1e4f506166d6a819819664e8c70ad8642a1386726d203
5
5
  SHA512:
6
- metadata.gz: 9023d6ed87da43f29ff553c88b2180fa168d158255613737e735dc673b8926193539d52df931f0809336e5918dcf26e012cb74ef7e61311d11c0e1e2fad5a446
7
- data.tar.gz: 8daf9ba059a8752246e98d416ff3b7a8682885ec6a9e858ecb595243d13f672548c07b2cbb199013839104d37952c46e165b3efc09176b785d3b0a9ed4b6e1c2
6
+ metadata.gz: caa5ed433a4afd863dcaa72e025faf87e8a827d88c0eecb8213591d91c5480c94ca47afcd6eb9b4bf5dc43fc885ffd33df207bad8d7766d26393a0e1724047c2
7
+ data.tar.gz: a2a4de3e89417613c6733e4a3404393d269f1afe2fd711df667a2d8959d488fbb798f53e6b5e36d853a0b07cc1463f1ec21cd22ad87ccd47d2367714874932e8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bling_api (0.1.4)
4
+ bling_api (0.1.6)
5
5
  ac
6
6
  base64
7
7
 
@@ -11,7 +11,7 @@ GEM
11
11
  ac (0.1.1)
12
12
  typhoeus
13
13
  attr_extras (7.1.0)
14
- base64 (0.1.1)
14
+ base64 (0.2.0)
15
15
  concurrent-ruby (1.2.2)
16
16
  diff-lcs (1.5.0)
17
17
  ethon (0.16.0)
@@ -2,15 +2,15 @@ module BlingApi
2
2
  class Customer
3
3
 
4
4
  def self.find_by_tax_id tax_id
5
- response_json = Client.new(BlingApi.access_token).find_contact_by_document_number(tax_id)
5
+ response_json = Client.new(BlingApi.configuration.access_token).find_contact_by_document_number(tax_id)
6
6
  if response_json
7
- contact = Client.new(BlingApi.access_token).get_contact(response_json["id"])
7
+ contact = Client.new(BlingApi.configuration.access_token).get_contact(response_json["id"])
8
8
  new(**build_hash(contact))
9
9
  end
10
10
  end
11
11
 
12
12
  def self.find_by_id id
13
- contact = Client.new(BlingApi.access_token).get_contact(id)
13
+ contact = Client.new(BlingApi.configuration.access_token).get_contact(id)
14
14
  new(**build_hash(contact))
15
15
  end
16
16
 
@@ -66,12 +66,12 @@ module BlingApi
66
66
  instance_variable_set("@#{key}", value)
67
67
  end
68
68
  end
69
- Client.new(BlingApi.access_token).update_contact(id, JSON.dump(build_json))
69
+ Client.new(BlingApi.configuration.access_token).update_contact(id, JSON.dump(build_json))
70
70
  self.class.find_by_id(self.id)
71
71
  end
72
72
 
73
73
  def create
74
- response = Client.new(BlingApi.access_token).create_contact(JSON.dump(build_json))
74
+ response = Client.new(BlingApi.configuration.access_token).create_contact(JSON.dump(build_json))
75
75
  self.class.find_by_id(response["id"])
76
76
  end
77
77
 
@@ -2,7 +2,7 @@ module BlingApi
2
2
  class Order
3
3
 
4
4
  def self.find_by_id id
5
- response = Client.new(BlingApi.access_token).get_order(id)
5
+ response = Client.new(BlingApi.configuration.access_token).get_order(id)
6
6
  new(**build_hash(response))
7
7
  end
8
8
 
@@ -58,7 +58,7 @@ module BlingApi
58
58
  end
59
59
 
60
60
  def create
61
- response = Client.new(BlingApi.access_token).create_order(JSON.dump(build_json))
61
+ response = Client.new(BlingApi.configuration.access_token).create_order(JSON.dump(build_json))
62
62
  self.class.find_by_id(response["id"])
63
63
  end
64
64
 
@@ -2,7 +2,7 @@ module BlingApi
2
2
  class Product
3
3
 
4
4
  def self.find_by_sku sku
5
- response_json = Client.new(BlingApi.access_token).find_product_by_sku(sku)
5
+ response_json = Client.new(BlingApi.configuration.access_token).find_product_by_sku(sku)
6
6
  if response_json
7
7
  new(**build_hash(response_json))
8
8
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BlingApi
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.6"
5
5
  end
data/lib/bling_api.rb CHANGED
@@ -16,12 +16,11 @@ module BlingApi
16
16
  attr_accessor :access_token
17
17
 
18
18
  def initialize
19
- @api_key = nil
20
19
  end
21
20
  end
22
21
 
23
22
  class << self
24
- attr_accessor :access_token
23
+ attr_accessor :configuration
25
24
  end
26
25
 
27
26
  def self.configure
@@ -0,0 +1,10 @@
1
+ module BlingApi
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("templates", __dir__)
5
+ def copy_initializer
6
+ template "initializer.rb", "config/initializers/bling_api.rb"
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ BlingApi.configure do |config|
2
+ config.access_token = nil
3
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bling_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - caio
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-13 00:00:00.000000000 Z
11
+ date: 2023-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ac
@@ -56,6 +56,8 @@ files:
56
56
  - lib/bling_api/order.rb
57
57
  - lib/bling_api/product.rb
58
58
  - lib/bling_api/version.rb
59
+ - lib/generators/bling_api/install/install_generator.rb
60
+ - lib/generators/bling_api/install/templates/initializer.rb
59
61
  homepage: https://github.com/CaioGarcia1
60
62
  licenses:
61
63
  - MIT