bling_api 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb3194fb22e5d52dbca204cdf66c625e49bd7aa8ace5d5d92a467e29132a7e0f
4
- data.tar.gz: 3276b6d0c5a833169f2993bfaa204b12a566929d7fca61f31ab6f04deaa45dc5
3
+ metadata.gz: 10f3e0abf05620ac8d795ea49272d18ec388494248fa3a85178fd6e9ec496488
4
+ data.tar.gz: c0efbb931037f47f88acde597995d0925956bbe42f909c0b3bb803f004d3850b
5
5
  SHA512:
6
- metadata.gz: 9023d6ed87da43f29ff553c88b2180fa168d158255613737e735dc673b8926193539d52df931f0809336e5918dcf26e012cb74ef7e61311d11c0e1e2fad5a446
7
- data.tar.gz: 8daf9ba059a8752246e98d416ff3b7a8682885ec6a9e858ecb595243d13f672548c07b2cbb199013839104d37952c46e165b3efc09176b785d3b0a9ed4b6e1c2
6
+ metadata.gz: 15dcd2c8b672d379691b40f3b15c1441b659936ffaca1957f69da3b8188194e45b00cbca12f13de2eb26ff533f742b41bf1df0d3d6bea4ebbbb4f0ee5891016d
7
+ data.tar.gz: c8ebec0245600208a0c0da2b25d7aca0a8c462c716b203236af5a6dadd45ae3eddb2ad5fb1feaacb58e0b11dd7da9b9ac208f0922eb6a4f91df827570e439098
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.5)
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.5"
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 = ""
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
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.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - caio
@@ -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