bling_api 0.1.0 → 0.1.1

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: '048de75fb5cc935a0ed4c2b4708ff9c9f9603bfdd8f96442035e351eaf2b8ead'
4
- data.tar.gz: 75904baa8b3aea1339d73d663adef8518d60a3ecb9dafa07740a855b79113c6b
3
+ metadata.gz: ef2affa96f185b9f44e1daaec70c7e82a1379491a3808f5e103929d6d001b00b
4
+ data.tar.gz: 55e3b6ef22800747a76f8bdd97df813be3b27676f5b734484def415442475815
5
5
  SHA512:
6
- metadata.gz: 6231c38d87ac59d1809c6fb346a6a4fe992c73480f8cbd8179c76934327b38e02524e1e77a083b66309e2e4141fb3a55ce551bcb17e8473541feefc3c1d6615b
7
- data.tar.gz: 3cc354154211ee42fd8abc69316ed7837be5f8762a8368b7c0c07b4ca55a82158b1c203e3f74aa0df4fdda9f5f57af20c8f61ff46f5512eeb621de918dd24233
6
+ metadata.gz: 93e6b1b6b5196f06382594bf56a4f02c6913f167faa8971bacf8375d4e70985a99d720b1120c0b52c6303fcf53c45a60018417c0e7626b6575a135442f4d34ed
7
+ data.tar.gz: 295c78ad801ba7104ff10275a1c2a7368496ea999ddb45f54982f1de394c4247f74293fb8d69365191eed1c8ad794ea7a7e3962d9f0bac22cdac659f15341417
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bling_api (0.1.0)
4
+ bling_api (0.1.1)
5
5
  ac
6
6
  base64
7
7
 
@@ -32,6 +32,7 @@ GEM
32
32
  ethon (>= 0.9.0)
33
33
 
34
34
  PLATFORMS
35
+ arm64-darwin-22
35
36
  x86_64-linux
36
37
 
37
38
  DEPENDENCIES
@@ -1,17 +1,16 @@
1
1
  module BlingApi
2
2
  class Customer
3
- ACCESS_TOKEN = "0039bb7d2d3e3c6777983361204dc168ecbf1ef8"
4
3
 
5
4
  def self.find_by_tax_id tax_id
6
- response_json = Client.new(ACCESS_TOKEN).find_contact_by_document_number(tax_id)
5
+ response_json = Client.new(BlingApi.access_token).find_contact_by_document_number(tax_id)
7
6
  if response_json
8
- contact = Client.new(ACCESS_TOKEN).get_contact(response_json["id"])
7
+ contact = Client.new(BlingApi.access_token).get_contact(response_json["id"])
9
8
  new(**build_hash(contact))
10
9
  end
11
10
  end
12
11
 
13
12
  def self.find_by_id id
14
- contact = Client.new(ACCESS_TOKEN).get_contact(id)
13
+ contact = Client.new(BlingApi.access_token).get_contact(id)
15
14
  new(**build_hash(contact))
16
15
  end
17
16
 
@@ -67,12 +66,12 @@ module BlingApi
67
66
  instance_variable_set("@#{key}", value)
68
67
  end
69
68
  end
70
- Client.new(ACCESS_TOKEN).update_contact(id, JSON.dump(build_json))
69
+ Client.new(BlingApi.access_token).update_contact(id, JSON.dump(build_json))
71
70
  self.class.find_by_id(self.id)
72
71
  end
73
72
 
74
73
  def create
75
- response = Client.new(ACCESS_TOKEN).create_contact(JSON.dump(build_json))
74
+ response = Client.new(BlingApi.access_token).create_contact(JSON.dump(build_json))
76
75
  self.class.find_by_id(response["id"])
77
76
  end
78
77
 
@@ -1,9 +1,8 @@
1
1
  module BlingApi
2
2
  class Order
3
- ACCESS_TOKEN = "0039bb7d2d3e3c6777983361204dc168ecbf1ef8"
4
3
 
5
4
  def self.find_by_id id
6
- response = Client.new(ACCESS_TOKEN).get_order(id)
5
+ response = Client.new(BlingApi.access_token).get_order(id)
7
6
  new(**build_hash(response))
8
7
  end
9
8
 
@@ -57,7 +56,7 @@ module BlingApi
57
56
  end
58
57
 
59
58
  def create
60
- response = Client.new(ACCESS_TOKEN).create_order(JSON.dump(build_json))
59
+ response = Client.new(BlingApi.access_token).create_order(JSON.dump(build_json))
61
60
  self.class.find_by_id(response["id"])
62
61
  end
63
62
 
@@ -1,9 +1,8 @@
1
1
  module BlingApi
2
2
  class Product
3
- ACCESS_TOKEN = "0039bb7d2d3e3c6777983361204dc168ecbf1ef8"
4
3
 
5
4
  def self.find_by_sku sku
6
- response_json = Client.new(ACCESS_TOKEN).find_product_by_sku(sku)
5
+ response_json = Client.new(BlingApi.access_token).find_product_by_sku(sku)
7
6
  if response_json
8
7
  new(**build_hash(response_json))
9
8
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BlingApi
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/bling_api.rb CHANGED
@@ -1,30 +1,30 @@
1
- # frozen_string_literal: true
2
-
3
- require "ac"
4
- require "base64"
5
- require_relative "bling_api/version"
6
- require_relative "bling_api/client"
7
- require_relative "bling_api/customer"
8
- require_relative "bling_api/order"
9
- require_relative "bling_api/product"
10
-
11
- module BlingApi
12
- class Error < StandardError; end
13
-
14
- class Configuration
15
- attr_accessor :access_token
16
-
17
- def initialize
18
- @api_key = nil
19
- end
20
- end
21
-
22
- class << self
23
- attr_accessor :access_token
24
- end
25
-
26
- def self.configure
27
- self.confiration ||= Configuration.new
28
- yield confiration
29
- end
30
- end
1
+ # frozen_string_literal: true
2
+
3
+ require "ac"
4
+ require "base64"
5
+ require_relative "bling_api/version"
6
+ require_relative "bling_api/client"
7
+ require_relative "bling_api/customer"
8
+ require_relative "bling_api/order"
9
+ require_relative "bling_api/product"
10
+
11
+ module BlingApi
12
+ class Error < StandardError; end
13
+
14
+ class Configuration
15
+ attr_accessor :access_token
16
+
17
+ def initialize
18
+ @api_key = nil
19
+ end
20
+ end
21
+
22
+ class << self
23
+ attr_accessor :access_token
24
+ end
25
+
26
+ def self.configure
27
+ self.confiration ||= Configuration.new
28
+ yield confiration
29
+ end
30
+ end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bling_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
  - caio
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
11
  date: 2023-11-10 00:00:00.000000000 Z
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description:
41
+ description:
42
42
  email:
43
43
  - caioif4@gmail.com
44
44
  executables: []
@@ -62,7 +62,7 @@ licenses:
62
62
  metadata:
63
63
  homepage_uri: https://github.com/CaioGarcia1
64
64
  source_code_uri: https://github.com/CaioGarcia1
65
- post_install_message:
65
+ post_install_message:
66
66
  rdoc_options: []
67
67
  require_paths:
68
68
  - lib
@@ -77,8 +77,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  requirements: []
80
- rubygems_version: 3.4.6
81
- signing_key:
80
+ rubygems_version: 3.4.20
81
+ signing_key:
82
82
  specification_version: 4
83
83
  summary: ''
84
84
  test_files: []