solidus_bling 4.0.1 → 4.0.3

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: fddb81e79337c486bf3524386936870231ab339ce311421f049cbd67f684606e
4
- data.tar.gz: '06109090246a5ff4efa114e5c2b66b626af0c05a30dbb51df5537537dc897325'
3
+ metadata.gz: ccb72e1708df3f63b6dd01358dc31a5f8b7e72f47f16b20422c9269e8d499727
4
+ data.tar.gz: 203d0985ef84d09811341f2e766fa0aade5d89faf15403d469006fb6bccda3b3
5
5
  SHA512:
6
- metadata.gz: e3f6716ac4d1e093996ebeedd106117baffc154a0dbec8bc0cfb0ad903b1fe10fad8b93abc5d1b2781891870cb7ba5d3a38bc9a9a9d91a507aaabef242810c30
7
- data.tar.gz: b06550c164e7f2c94d0de55793a523dea48b877031426f4ba19183681cddb28ce4b97afa99ff40be69b64f1e4c9a14c38bdd1b56c0bf4e269cee5eaaa5b32f38
6
+ metadata.gz: 5b16811b28eadab087e090bc147ecb580c8c3b458d85136e7c3f591453a87f2e6ad1def844f27818441cf4617fb72642cc2556d7b3dc7db062c637bb7131ef95
7
+ data.tar.gz: 42dc5b749af79e07dd4a6997b54501530addaeb610514fe7e8bc69b017f8a68143e6b1d130b35ed056356c8b815ab28cf581b569a765650cee11edd2a25a57cf
@@ -0,0 +1,16 @@
1
+ module SolidusBling
2
+ class Product
3
+ def self.find_by_sku sku
4
+ account = SolidusBling::Account.first
5
+ client = SolidusBling::BlingClient.for_account(account)
6
+
7
+ product = client.find_product_by_sku(sku).data
8
+ raise "Produto com SKU: #{sku} não encontrado no Bling" if product.blank?
9
+ {
10
+ name: product[0].nome,
11
+ sku: product[0].codigo,
12
+ price: product[0].preco.to_f
13
+ }
14
+ end
15
+ end
16
+ end
@@ -6,13 +6,7 @@ module SolidusBling
6
6
  after_save :falsify_all_others
7
7
 
8
8
  def self.upsert_sellers account
9
- client = BlingApi::Client.new(
10
- client_id: account.client_id,
11
- client_secret: account.client_secret,
12
- refresh_token: account.refresh_token,
13
- access_token: account.access_token,
14
- token_expires_at: account.token_expires_in
15
- )
9
+ client = SolidusBling::BlingClient.for_account(account)
16
10
  sellers = client.get_sellers(1, 100, "A").data
17
11
  upsert_sellers = sellers.map { |seller| {name: seller.contato.nome, external_id: seller.id, account_id: account.id, active: true} }
18
12
  SolidusBling::Seller.upsert_all(upsert_sellers, unique_by: :external_id)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusBling
4
- VERSION = "4.0.1"
4
+ VERSION = "4.0.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_bling
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todas Essas Coisas
@@ -55,6 +55,7 @@ files:
55
55
  - app/models/solidus_bling/event.rb
56
56
  - app/models/solidus_bling/order.rb
57
57
  - app/models/solidus_bling/payment_method.rb
58
+ - app/models/solidus_bling/product.rb
58
59
  - app/models/solidus_bling/seller.rb
59
60
  - app/models/solidus_bling/shipping_method.rb
60
61
  - app/models/spree/permission_sets/seller_update.rb
@@ -108,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
109
  - !ruby/object:Gem::Version
109
110
  version: '0'
110
111
  requirements: []
111
- rubygems_version: 3.6.7
112
+ rubygems_version: 3.6.9
112
113
  specification_version: 4
113
114
  summary: Solidus extension to integrate with the Bling
114
115
  test_files: []