ruby-etsy 0.0.2 → 0.0.4

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: aacff473114220017a6ad466b7764c70f28b50b2f32e7fa242778dc5812eb036
4
- data.tar.gz: 600c32130456c4dbeb82bcabfe86cd20592ff62f2afd426fe28960404a629004
3
+ metadata.gz: e9660b0a445d0f3d1e2ecf62fc767583547b2402c2da00fdc57c508df6347036
4
+ data.tar.gz: e248592fdee4408b774b920f094be1e39a0d4932eaf910028ec167f345aca526
5
5
  SHA512:
6
- metadata.gz: f893cecd3531bbbf5f13c37b8a84bbc0eb4aed8aff52dcee34ad2df56280b0d9795c9062498faf2fb8ea274a2d1f4339a003d796f8e6c3a2550acd836a574f0a
7
- data.tar.gz: da077e8ca197f2a1428689a843d75a07bb93d756349d9d54b71ad1e1a8eb33f31b4e6ba03e6df12954234e93eecf89fc7ae0b5cd05c9269d28efd825b76f7233
6
+ metadata.gz: 5eb9f863c7ed6d4758eccb1564828e82cca6ce30c95926042b33dba968826a7f3770a075a031565507694d5bbc41d5a1da4c88510e2c9506af0a3f9cbea234aa
7
+ data.tar.gz: d11d0aa410c89e43f10b2e7e763cdf004927f78b14f787338da38d372e6a8911bc3589bb48722ceefbccc0960b77a13311c25e0ce917f1a3585e98772d856474
@@ -5,6 +5,8 @@ require 'active_support'
5
5
  require 'active_support/core_ext'
6
6
 
7
7
  class RubyEtsy
8
+ class RefreshTokenError < StandardError; end;
9
+
8
10
  class Client
9
11
 
10
12
  REFRESH_TOKEN_URL='https://api.etsy.com/v3/public/oauth/token'
@@ -42,8 +44,9 @@ class RubyEtsy
42
44
  rescue RestClient::Unauthorized => e
43
45
  puts "RESCUED UNATHORIZED"
44
46
 
45
- refresh_token
46
- action(url, http_method: :get)
47
+ token = send :refresh_token
48
+
49
+ raise RefreshTokenError.new('Could not refresh token') unless token.success?
47
50
  end
48
51
 
49
52
  def refresh_token
@@ -63,12 +66,15 @@ class RubyEtsy
63
66
  )
64
67
 
65
68
  parsed = JSON.parse(response.body)
69
+
66
70
  @access_token = parsed['access_token']
67
71
  @refresh_token = parsed['refresh_token']
68
72
 
69
73
  puts parsed
70
74
 
71
75
  ::HttpParser.parse(response)
76
+ rescue RestClient::ExceptionWithResponse => e
77
+ ::HttpParser.parse(OpenStruct.new(code: e.http_code, body: e.http_body))
72
78
  end
73
79
 
74
80
  private
@@ -1,3 +1,3 @@
1
1
  class RubyEtsy
2
- VERSION="0.0.2"
2
+ VERSION="0.0.4"
3
3
  end
data/lib/ruby-etsy.rb CHANGED
@@ -2,7 +2,6 @@ require 'ruby-etsy/client'
2
2
  require 'ruby-etsy/calls'
3
3
  require 'ruby-etsy/version'
4
4
  require 'ruby-etsy/configuration'
5
- require 'byebug'
6
5
 
7
6
  class RubyEtsy
8
7
  include Calls
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-etsy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adem Dinarevic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-07 00:00:00.000000000 Z
11
+ date: 2023-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  requirements: []
87
- rubygems_version: 3.0.9
87
+ rubygems_version: 3.3.7
88
88
  signing_key:
89
89
  specification_version: 4
90
90
  summary: Ruby client for Etsy API