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 +4 -4
- data/Gemfile.lock +2 -1
- data/lib/bling_api/customer.rb +5 -6
- data/lib/bling_api/order.rb +2 -3
- data/lib/bling_api/product.rb +1 -2
- data/lib/bling_api/version.rb +1 -1
- data/lib/bling_api.rb +30 -30
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef2affa96f185b9f44e1daaec70c7e82a1379491a3808f5e103929d6d001b00b
|
4
|
+
data.tar.gz: 55e3b6ef22800747a76f8bdd97df813be3b27676f5b734484def415442475815
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93e6b1b6b5196f06382594bf56a4f02c6913f167faa8971bacf8375d4e70985a99d720b1120c0b52c6303fcf53c45a60018417c0e7626b6575a135442f4d34ed
|
7
|
+
data.tar.gz: 295c78ad801ba7104ff10275a1c2a7368496ea999ddb45f54982f1de394c4247f74293fb8d69365191eed1c8ad794ea7a7e3962d9f0bac22cdac659f15341417
|
data/Gemfile.lock
CHANGED
data/lib/bling_api/customer.rb
CHANGED
@@ -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(
|
5
|
+
response_json = Client.new(BlingApi.access_token).find_contact_by_document_number(tax_id)
|
7
6
|
if response_json
|
8
|
-
contact = Client.new(
|
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(
|
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(
|
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(
|
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
|
|
data/lib/bling_api/order.rb
CHANGED
@@ -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(
|
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(
|
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
|
|
data/lib/bling_api/product.rb
CHANGED
@@ -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(
|
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
|
data/lib/bling_api/version.rb
CHANGED
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.
|
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.
|
81
|
-
signing_key:
|
80
|
+
rubygems_version: 3.4.20
|
81
|
+
signing_key:
|
82
82
|
specification_version: 4
|
83
83
|
summary: ''
|
84
84
|
test_files: []
|