betsy 0.2.0 → 0.2.1
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 +4 -4
- data/.ruby-version +1 -0
- data/Gemfile.lock +5 -21
- data/betsy.gemspec +1 -1
- data/lib/betsy/model.rb +7 -1
- data/lib/betsy/shop_receipt_transaction.rb +11 -0
- data/lib/betsy/user.rb +6 -11
- data/lib/betsy/version.rb +1 -1
- data/lib/betsy.rb +7 -2
- data/lib/generators/betsy/install_generator.rb +2 -1
- data/lib/generators/betsy/templates/{create_etsy_accounts.rb → create_etsy_accounts.rb.tt} +1 -1
- data/lib/generators/betsy/templates/etsy_account.rb.tt +2 -0
- metadata +10 -10
- data/betsy-0.1.0.gem +0 -0
- data/lib/generators/betsy/templates/etsy_account.rb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 343e99ec22018a9e3a9213d0347a41c7e2467ae065663d0949f911569e9e18ee
|
4
|
+
data.tar.gz: d30007fc1dd8c093db8e3281b438e21431cdce28ec2da31298d331c69c3811af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63eefeee0bba2edab434f1b702ab82d1fd694611c73d72c21ab8235cf24504a9649fc82297ce81daafde98cbfc130a6ce518d907d37add81f83475e6cff7e708
|
7
|
+
data.tar.gz: 0f27a68eb7ed1682c10c2440f5e2f5be421f3491e1fd5137ba44918884a7cc4a0e21bf41f8ea96876803ee02cf435f835e32ec438174e57ce1bff5af7ac9c603
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.4
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
betsy (0.
|
5
|
-
faraday (
|
4
|
+
betsy (0.2.0)
|
5
|
+
faraday (>= 0.10)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
@@ -83,23 +83,8 @@ GEM
|
|
83
83
|
diff-lcs (1.4.4)
|
84
84
|
docile (1.4.0)
|
85
85
|
erubi (1.10.0)
|
86
|
-
faraday (
|
87
|
-
faraday-em_http (~> 1.0)
|
88
|
-
faraday-em_synchrony (~> 1.0)
|
89
|
-
faraday-excon (~> 1.1)
|
90
|
-
faraday-httpclient (~> 1.0.1)
|
91
|
-
faraday-net_http (~> 1.0)
|
92
|
-
faraday-net_http_persistent (~> 1.1)
|
93
|
-
faraday-patron (~> 1.0)
|
86
|
+
faraday (0.17.6)
|
94
87
|
multipart-post (>= 1.2, < 3)
|
95
|
-
ruby2_keywords (>= 0.0.4)
|
96
|
-
faraday-em_http (1.0.0)
|
97
|
-
faraday-em_synchrony (1.0.0)
|
98
|
-
faraday-excon (1.1.0)
|
99
|
-
faraday-httpclient (1.0.1)
|
100
|
-
faraday-net_http (1.0.1)
|
101
|
-
faraday-net_http_persistent (1.2.0)
|
102
|
-
faraday-patron (1.0.0)
|
103
88
|
globalid (0.5.2)
|
104
89
|
activesupport (>= 5.0)
|
105
90
|
hashdiff (1.0.1)
|
@@ -115,7 +100,7 @@ GEM
|
|
115
100
|
method_source (1.0.0)
|
116
101
|
mini_mime (1.1.0)
|
117
102
|
minitest (5.14.4)
|
118
|
-
multipart-post (2.
|
103
|
+
multipart-post (2.3.0)
|
119
104
|
nio4r (2.5.8)
|
120
105
|
nokogiri (1.12.2-x86_64-linux)
|
121
106
|
racc (~> 1.4)
|
@@ -185,7 +170,6 @@ GEM
|
|
185
170
|
rubocop (>= 1.7.0, < 2.0)
|
186
171
|
rubocop-ast (>= 0.4.0)
|
187
172
|
ruby-progressbar (1.11.0)
|
188
|
-
ruby2_keywords (0.0.5)
|
189
173
|
simplecov (0.16.1)
|
190
174
|
docile (~> 1.1)
|
191
175
|
json (>= 1.8, < 3)
|
@@ -234,4 +218,4 @@ DEPENDENCIES
|
|
234
218
|
webmock (~> 3.13.0)
|
235
219
|
|
236
220
|
BUNDLED WITH
|
237
|
-
2.2.
|
221
|
+
2.2.33
|
data/betsy.gemspec
CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_development_dependency("webmock", "~> 3.13.0")
|
38
38
|
spec.add_development_dependency("coveralls")
|
39
39
|
|
40
|
-
spec.add_dependency("faraday", "
|
40
|
+
spec.add_dependency("faraday", ">= 0.10")
|
41
41
|
|
42
42
|
# For more information and examples about making a new gem, checkout our
|
43
43
|
# guide at: https://bundler.io/guides/creating_gem.html
|
data/lib/betsy/model.rb
CHANGED
@@ -13,7 +13,13 @@ module Betsy
|
|
13
13
|
check_token_expiration(options[:etsy_account]) if options[:etsy_account]
|
14
14
|
headers = access_credentials(options[:etsy_account])
|
15
15
|
options.delete(:etsy_account)
|
16
|
-
|
16
|
+
|
17
|
+
if [:post, :put, :patch].include?(request_type)
|
18
|
+
headers = headers.reverse_merge(content_type: "application/json")
|
19
|
+
options = options.to_json
|
20
|
+
end
|
21
|
+
|
22
|
+
response = Faraday.send(request_type, "#{BASE_ETSY_API_URL}#{endpoint}", options, headers)
|
17
23
|
handle_response(response)
|
18
24
|
end
|
19
25
|
|
@@ -10,6 +10,7 @@ module Betsy
|
|
10
10
|
attribute :seller_user_id
|
11
11
|
attribute :buyer_user_id
|
12
12
|
attribute :create_timestamp
|
13
|
+
attribute :created_timestamp
|
13
14
|
attribute :paid_timestamp
|
14
15
|
attribute :shipped_timestamp
|
15
16
|
attribute :quantity
|
@@ -20,9 +21,19 @@ module Betsy
|
|
20
21
|
attribute :listing_id
|
21
22
|
attribute :transaction_type
|
22
23
|
attribute :product_id
|
24
|
+
attribute :sku
|
23
25
|
attribute :price
|
24
26
|
attribute :shipping_cost
|
25
27
|
attribute :variations
|
28
|
+
attribute :product_data
|
29
|
+
attribute :shipping_profile_id
|
30
|
+
attribute :min_processing_days
|
31
|
+
attribute :max_processing_days
|
32
|
+
attribute :shipping_method
|
33
|
+
attribute :shipping_upgrade
|
34
|
+
attribute :expected_ship_date
|
35
|
+
attribute :buyer_coupon
|
36
|
+
attribute :shop_coupon
|
26
37
|
|
27
38
|
def self.get_shop_receipt_transactions_by_listing(shop_id, listing_id, options = {})
|
28
39
|
make_request(:get, "/v3/application/shops/#{shop_id}/listings/#{listing_id}/transactions", options)
|
data/lib/betsy/user.rb
CHANGED
@@ -5,23 +5,18 @@ module Betsy
|
|
5
5
|
include Betsy::Model
|
6
6
|
|
7
7
|
attribute :user_id
|
8
|
-
attribute :
|
8
|
+
attribute :shop_id
|
9
9
|
attribute :primary_email
|
10
10
|
attribute :first_name
|
11
11
|
attribute :last_name
|
12
|
-
attribute :
|
13
|
-
attribute :referred_by_user_id
|
14
|
-
attribute :use_new_inventory_endpoints
|
15
|
-
attribute :is_seller
|
16
|
-
attribute :bio
|
17
|
-
attribute :gender
|
18
|
-
attribute :birth_month
|
19
|
-
attribute :birth_day
|
20
|
-
attribute :transaction_buy_count
|
21
|
-
attribute :transaction_sold_count
|
12
|
+
attribute :image_url_75x75
|
22
13
|
|
23
14
|
def self.get_user(user_id, options = {})
|
24
15
|
make_request(:get, "/v3/application/users/#{user_id}", options)
|
25
16
|
end
|
17
|
+
|
18
|
+
def self.get_me(options = {})
|
19
|
+
make_request(:get, "/v3/application/users/me", options)
|
20
|
+
end
|
26
21
|
end
|
27
22
|
end
|
data/lib/betsy/version.rb
CHANGED
data/lib/betsy.rb
CHANGED
@@ -33,6 +33,7 @@ module Betsy
|
|
33
33
|
|
34
34
|
mattr_accessor :api_key
|
35
35
|
mattr_accessor :redirect_uri_base
|
36
|
+
mattr_accessor :account_model, default: "EtsyAccount"
|
36
37
|
|
37
38
|
ALL_SCOPES = ["address_r",
|
38
39
|
"address_w",
|
@@ -72,7 +73,7 @@ module Betsy
|
|
72
73
|
code_verifier = generate_code_verifier
|
73
74
|
code_challenge = Digest::SHA256.base64digest(code_verifier).tr("+/", "-_").tr("=", "")
|
74
75
|
|
75
|
-
|
76
|
+
account_class.create(state: state, code_verifier: code_verifier)
|
76
77
|
|
77
78
|
"https://www.etsy.com/oauth/connect" \
|
78
79
|
"?response_type=code" \
|
@@ -85,7 +86,7 @@ module Betsy
|
|
85
86
|
end
|
86
87
|
|
87
88
|
def self.request_access_token(params)
|
88
|
-
etsy_account =
|
89
|
+
etsy_account = account_class.find_by(state: params[:state])
|
89
90
|
if etsy_account.present?
|
90
91
|
options = {
|
91
92
|
grant_type: "authorization_code",
|
@@ -105,6 +106,10 @@ module Betsy
|
|
105
106
|
end
|
106
107
|
end
|
107
108
|
|
109
|
+
def self.account_class
|
110
|
+
@@account_class ||= account_model.constantize
|
111
|
+
end
|
112
|
+
|
108
113
|
class << self
|
109
114
|
private
|
110
115
|
|
@@ -11,7 +11,8 @@ module Betsy
|
|
11
11
|
source_root File.expand_path("../templates", __FILE__)
|
12
12
|
|
13
13
|
def copy_betsy_model
|
14
|
-
|
14
|
+
model_file = Betsy.account_model.underscore
|
15
|
+
template "etsy_account.rb", "app/models/#{model_file}.rb"
|
15
16
|
end
|
16
17
|
|
17
18
|
def copy_betsy_migration
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: betsy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jace Bayless
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -112,16 +112,16 @@ dependencies:
|
|
112
112
|
name: faraday
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: '0.10'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: '0.10'
|
125
125
|
description: This gem allows users to simply interact with the Etsy V3 API.
|
126
126
|
email:
|
127
127
|
- jacebayless@gmail.com
|
@@ -131,6 +131,7 @@ extra_rdoc_files: []
|
|
131
131
|
files:
|
132
132
|
- ".gitignore"
|
133
133
|
- ".rspec"
|
134
|
+
- ".ruby-version"
|
134
135
|
- ".travis.yml"
|
135
136
|
- CHANGELOG.md
|
136
137
|
- CODE_OF_CONDUCT.md
|
@@ -141,7 +142,6 @@ files:
|
|
141
142
|
- Rakefile
|
142
143
|
- app/controllers/betsy/response_listener_controller.rb
|
143
144
|
- app/views/betsy/response_listener/etsy_response_listener.html.erb
|
144
|
-
- betsy-0.1.0.gem
|
145
145
|
- betsy.gemspec
|
146
146
|
- bin/console
|
147
147
|
- bin/setup
|
@@ -174,8 +174,8 @@ files:
|
|
174
174
|
- lib/betsy/version.rb
|
175
175
|
- lib/generators/betsy/install_generator.rb
|
176
176
|
- lib/generators/betsy/templates/betsy.rb
|
177
|
-
- lib/generators/betsy/templates/create_etsy_accounts.rb
|
178
|
-
- lib/generators/betsy/templates/etsy_account.rb
|
177
|
+
- lib/generators/betsy/templates/create_etsy_accounts.rb.tt
|
178
|
+
- lib/generators/betsy/templates/etsy_account.rb.tt
|
179
179
|
homepage: https://github.com/JaceBayless/betsy
|
180
180
|
licenses:
|
181
181
|
- MIT
|
@@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
199
|
- !ruby/object:Gem::Version
|
200
200
|
version: '0'
|
201
201
|
requirements: []
|
202
|
-
rubygems_version: 3.2.
|
202
|
+
rubygems_version: 3.2.33
|
203
203
|
signing_key:
|
204
204
|
specification_version: 4
|
205
205
|
summary: A gem for the Etsy API V3
|
data/betsy-0.1.0.gem
DELETED
Binary file
|