betsy 0.2.0
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 +7 -0
- data/.gitignore +8 -0
- data/.rspec +1 -0
- data/.travis.yml +15 -0
- data/CHANGELOG.md +9 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +237 -0
- data/LICENSE.txt +21 -0
- data/README.md +79 -0
- data/Rakefile +12 -0
- data/app/controllers/betsy/response_listener_controller.rb +5 -0
- data/app/views/betsy/response_listener/etsy_response_listener.html.erb +1 -0
- data/betsy-0.1.0.gem +0 -0
- data/betsy.gemspec +44 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/config/routes.rb +3 -0
- data/lib/betsy/engine.rb +11 -0
- data/lib/betsy/error.rb +10 -0
- data/lib/betsy/ledger_entry.rb +20 -0
- data/lib/betsy/model.rb +73 -0
- data/lib/betsy/other.rb +13 -0
- data/lib/betsy/payment.rb +44 -0
- data/lib/betsy/review.rb +22 -0
- data/lib/betsy/seller_taxonomy.rb +36 -0
- data/lib/betsy/shop.rb +69 -0
- data/lib/betsy/shop_listing.rb +124 -0
- data/lib/betsy/shop_listing_file.rb +32 -0
- data/lib/betsy/shop_listing_image.rb +42 -0
- data/lib/betsy/shop_listing_inventory.rb +21 -0
- data/lib/betsy/shop_listing_offering.rb +17 -0
- data/lib/betsy/shop_listing_product.rb +17 -0
- data/lib/betsy/shop_listing_translation.rb +25 -0
- data/lib/betsy/shop_listing_variation_image.rb +19 -0
- data/lib/betsy/shop_production_partner.rb +15 -0
- data/lib/betsy/shop_receipt.rb +54 -0
- data/lib/betsy/shop_receipt_transaction.rb +43 -0
- data/lib/betsy/shop_section.rb +25 -0
- data/lib/betsy/shop_shipping_profile.rb +105 -0
- data/lib/betsy/user.rb +27 -0
- data/lib/betsy/user_address.rb +27 -0
- data/lib/betsy/version.rb +5 -0
- data/lib/betsy.rb +121 -0
- data/lib/generators/betsy/install_generator.rb +35 -0
- data/lib/generators/betsy/templates/betsy.rb +9 -0
- data/lib/generators/betsy/templates/create_etsy_accounts.rb +14 -0
- data/lib/generators/betsy/templates/etsy_account.rb +2 -0
- metadata +206 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3ba97ebe9949b2fa6512f323b2ff4e9214e26bee642afbec58fb83bb2f16af83
|
4
|
+
data.tar.gz: fbfdb2302982e26ec76e0f205c14d2a70929befa5813d99bdd54c9eb70e50cd7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 630d6f49d34e9f1e7b66cf3e369442c2b28884c23db693a31174b1442838f37eeb134e8937cca8ea018ee6397d9f74c3db444e9aff6f0feb547491e22626145e
|
7
|
+
data.tar.gz: 7d420367b78b8313a940e31c9d878d416e5469cb7d0fad91f85552fdabce0ef293d591131ace10ef36032d5327dbb3b74127eff5f799a4c8fbb9a5893eabf53f
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at jacebayless@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,237 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
betsy (0.1.0)
|
5
|
+
faraday (= 1.5.1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actioncable (6.1.4)
|
11
|
+
actionpack (= 6.1.4)
|
12
|
+
activesupport (= 6.1.4)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
actionmailbox (6.1.4)
|
16
|
+
actionpack (= 6.1.4)
|
17
|
+
activejob (= 6.1.4)
|
18
|
+
activerecord (= 6.1.4)
|
19
|
+
activestorage (= 6.1.4)
|
20
|
+
activesupport (= 6.1.4)
|
21
|
+
mail (>= 2.7.1)
|
22
|
+
actionmailer (6.1.4)
|
23
|
+
actionpack (= 6.1.4)
|
24
|
+
actionview (= 6.1.4)
|
25
|
+
activejob (= 6.1.4)
|
26
|
+
activesupport (= 6.1.4)
|
27
|
+
mail (~> 2.5, >= 2.5.4)
|
28
|
+
rails-dom-testing (~> 2.0)
|
29
|
+
actionpack (6.1.4)
|
30
|
+
actionview (= 6.1.4)
|
31
|
+
activesupport (= 6.1.4)
|
32
|
+
rack (~> 2.0, >= 2.0.9)
|
33
|
+
rack-test (>= 0.6.3)
|
34
|
+
rails-dom-testing (~> 2.0)
|
35
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
36
|
+
actiontext (6.1.4)
|
37
|
+
actionpack (= 6.1.4)
|
38
|
+
activerecord (= 6.1.4)
|
39
|
+
activestorage (= 6.1.4)
|
40
|
+
activesupport (= 6.1.4)
|
41
|
+
nokogiri (>= 1.8.5)
|
42
|
+
actionview (6.1.4)
|
43
|
+
activesupport (= 6.1.4)
|
44
|
+
builder (~> 3.1)
|
45
|
+
erubi (~> 1.4)
|
46
|
+
rails-dom-testing (~> 2.0)
|
47
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
48
|
+
activejob (6.1.4)
|
49
|
+
activesupport (= 6.1.4)
|
50
|
+
globalid (>= 0.3.6)
|
51
|
+
activemodel (6.1.4)
|
52
|
+
activesupport (= 6.1.4)
|
53
|
+
activerecord (6.1.4)
|
54
|
+
activemodel (= 6.1.4)
|
55
|
+
activesupport (= 6.1.4)
|
56
|
+
activestorage (6.1.4)
|
57
|
+
actionpack (= 6.1.4)
|
58
|
+
activejob (= 6.1.4)
|
59
|
+
activerecord (= 6.1.4)
|
60
|
+
activesupport (= 6.1.4)
|
61
|
+
marcel (~> 1.0.0)
|
62
|
+
mini_mime (>= 1.1.0)
|
63
|
+
activesupport (6.1.4)
|
64
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
65
|
+
i18n (>= 1.6, < 2)
|
66
|
+
minitest (>= 5.1)
|
67
|
+
tzinfo (~> 2.0)
|
68
|
+
zeitwerk (~> 2.3)
|
69
|
+
addressable (2.8.0)
|
70
|
+
public_suffix (>= 2.0.2, < 5.0)
|
71
|
+
ast (2.4.2)
|
72
|
+
builder (3.2.4)
|
73
|
+
concurrent-ruby (1.1.9)
|
74
|
+
coveralls (0.8.23)
|
75
|
+
json (>= 1.8, < 3)
|
76
|
+
simplecov (~> 0.16.1)
|
77
|
+
term-ansicolor (~> 1.3)
|
78
|
+
thor (>= 0.19.4, < 2.0)
|
79
|
+
tins (~> 1.6)
|
80
|
+
crack (0.4.5)
|
81
|
+
rexml
|
82
|
+
crass (1.0.6)
|
83
|
+
diff-lcs (1.4.4)
|
84
|
+
docile (1.4.0)
|
85
|
+
erubi (1.10.0)
|
86
|
+
faraday (1.5.1)
|
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)
|
94
|
+
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
|
+
globalid (0.5.2)
|
104
|
+
activesupport (>= 5.0)
|
105
|
+
hashdiff (1.0.1)
|
106
|
+
i18n (1.8.10)
|
107
|
+
concurrent-ruby (~> 1.0)
|
108
|
+
json (2.5.1)
|
109
|
+
loofah (2.11.0)
|
110
|
+
crass (~> 1.0.2)
|
111
|
+
nokogiri (>= 1.5.9)
|
112
|
+
mail (2.7.1)
|
113
|
+
mini_mime (>= 0.1.1)
|
114
|
+
marcel (1.0.1)
|
115
|
+
method_source (1.0.0)
|
116
|
+
mini_mime (1.1.0)
|
117
|
+
minitest (5.14.4)
|
118
|
+
multipart-post (2.1.1)
|
119
|
+
nio4r (2.5.8)
|
120
|
+
nokogiri (1.12.2-x86_64-linux)
|
121
|
+
racc (~> 1.4)
|
122
|
+
parallel (1.20.1)
|
123
|
+
parser (3.0.2.0)
|
124
|
+
ast (~> 2.4.1)
|
125
|
+
public_suffix (4.0.6)
|
126
|
+
racc (1.5.2)
|
127
|
+
rack (2.2.3)
|
128
|
+
rack-test (1.1.0)
|
129
|
+
rack (>= 1.0, < 3)
|
130
|
+
rails (6.1.4)
|
131
|
+
actioncable (= 6.1.4)
|
132
|
+
actionmailbox (= 6.1.4)
|
133
|
+
actionmailer (= 6.1.4)
|
134
|
+
actionpack (= 6.1.4)
|
135
|
+
actiontext (= 6.1.4)
|
136
|
+
actionview (= 6.1.4)
|
137
|
+
activejob (= 6.1.4)
|
138
|
+
activemodel (= 6.1.4)
|
139
|
+
activerecord (= 6.1.4)
|
140
|
+
activestorage (= 6.1.4)
|
141
|
+
activesupport (= 6.1.4)
|
142
|
+
bundler (>= 1.15.0)
|
143
|
+
railties (= 6.1.4)
|
144
|
+
sprockets-rails (>= 2.0.0)
|
145
|
+
rails-dom-testing (2.0.3)
|
146
|
+
activesupport (>= 4.2.0)
|
147
|
+
nokogiri (>= 1.6)
|
148
|
+
rails-html-sanitizer (1.3.0)
|
149
|
+
loofah (~> 2.3)
|
150
|
+
railties (6.1.4)
|
151
|
+
actionpack (= 6.1.4)
|
152
|
+
activesupport (= 6.1.4)
|
153
|
+
method_source
|
154
|
+
rake (>= 0.13)
|
155
|
+
thor (~> 1.0)
|
156
|
+
rainbow (3.0.0)
|
157
|
+
rake (13.0.6)
|
158
|
+
regexp_parser (2.1.1)
|
159
|
+
rexml (3.2.5)
|
160
|
+
rspec (3.10.0)
|
161
|
+
rspec-core (~> 3.10.0)
|
162
|
+
rspec-expectations (~> 3.10.0)
|
163
|
+
rspec-mocks (~> 3.10.0)
|
164
|
+
rspec-core (3.10.1)
|
165
|
+
rspec-support (~> 3.10.0)
|
166
|
+
rspec-expectations (3.10.1)
|
167
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
168
|
+
rspec-support (~> 3.10.0)
|
169
|
+
rspec-mocks (3.10.2)
|
170
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
171
|
+
rspec-support (~> 3.10.0)
|
172
|
+
rspec-support (3.10.2)
|
173
|
+
rubocop (1.18.4)
|
174
|
+
parallel (~> 1.10)
|
175
|
+
parser (>= 3.0.0.0)
|
176
|
+
rainbow (>= 2.2.2, < 4.0)
|
177
|
+
regexp_parser (>= 1.8, < 3.0)
|
178
|
+
rexml
|
179
|
+
rubocop-ast (>= 1.8.0, < 2.0)
|
180
|
+
ruby-progressbar (~> 1.7)
|
181
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
182
|
+
rubocop-ast (1.9.0)
|
183
|
+
parser (>= 3.0.1.1)
|
184
|
+
rubocop-performance (1.11.4)
|
185
|
+
rubocop (>= 1.7.0, < 2.0)
|
186
|
+
rubocop-ast (>= 0.4.0)
|
187
|
+
ruby-progressbar (1.11.0)
|
188
|
+
ruby2_keywords (0.0.5)
|
189
|
+
simplecov (0.16.1)
|
190
|
+
docile (~> 1.1)
|
191
|
+
json (>= 1.8, < 3)
|
192
|
+
simplecov-html (~> 0.10.0)
|
193
|
+
simplecov-html (0.10.2)
|
194
|
+
sprockets (4.0.2)
|
195
|
+
concurrent-ruby (~> 1.0)
|
196
|
+
rack (> 1, < 3)
|
197
|
+
sprockets-rails (3.2.2)
|
198
|
+
actionpack (>= 4.0)
|
199
|
+
activesupport (>= 4.0)
|
200
|
+
sprockets (>= 3.0.0)
|
201
|
+
sqlite3 (1.4.2)
|
202
|
+
standard (1.1.7)
|
203
|
+
rubocop (= 1.18.4)
|
204
|
+
rubocop-performance (= 1.11.4)
|
205
|
+
sync (0.5.0)
|
206
|
+
term-ansicolor (1.7.1)
|
207
|
+
tins (~> 1.0)
|
208
|
+
thor (1.1.0)
|
209
|
+
tins (1.29.1)
|
210
|
+
sync
|
211
|
+
tzinfo (2.0.4)
|
212
|
+
concurrent-ruby (~> 1.0)
|
213
|
+
unicode-display_width (2.0.0)
|
214
|
+
webmock (3.13.0)
|
215
|
+
addressable (>= 2.3.6)
|
216
|
+
crack (>= 0.3.2)
|
217
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
218
|
+
websocket-driver (0.7.5)
|
219
|
+
websocket-extensions (>= 0.1.0)
|
220
|
+
websocket-extensions (0.1.5)
|
221
|
+
zeitwerk (2.4.2)
|
222
|
+
|
223
|
+
PLATFORMS
|
224
|
+
x86_64-linux
|
225
|
+
|
226
|
+
DEPENDENCIES
|
227
|
+
betsy!
|
228
|
+
coveralls
|
229
|
+
rails
|
230
|
+
rake
|
231
|
+
rspec (~> 3.10)
|
232
|
+
sqlite3
|
233
|
+
standard (~> 1.1.7)
|
234
|
+
webmock (~> 3.13.0)
|
235
|
+
|
236
|
+
BUNDLED WITH
|
237
|
+
2.2.17
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Jace Bayless
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
[](https://rubygems.org/gems/betsy)
|
2
|
+
[](https://app.travis-ci.com/JaceBayless/betsy)
|
3
|
+
[](https://coveralls.io/github/JaceBayless/betsy?branch=main)
|
4
|
+
[](https://codeclimate.com/github/JaceBayless/betsy/maintainability)
|
5
|
+
|
6
|
+
# Betsy
|
7
|
+
|
8
|
+
Betsy is an unopinionated gem for using the Etsy API. Betsy is designed to be a 1-to-1 mapping of Etsy's API giving you access to all endpoints and all available data.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
First, install Betsy by adding it to your gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'betsy'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then run:
|
19
|
+
|
20
|
+
$ bundle install
|
21
|
+
|
22
|
+
Next, you need to run the generator:
|
23
|
+
|
24
|
+
$ rails generate betsy:install
|
25
|
+
|
26
|
+
Running the generator will create an `etsy_account` model in your app as well as a migration for this model. The purpose of this model is to allow you to easily link and store an Etsy account. This model is used within the gem by providing the `access_token` and `refresh_token` needed with making calls that require authentication. You can add anything to this model as long as the original fields are left as-is. This may be useful if you wish your application to have relations with an Etsy account.
|
27
|
+
|
28
|
+
Finally, you need to run the migration:
|
29
|
+
|
30
|
+
$ rails db:migrate
|
31
|
+
|
32
|
+
## Usage
|
33
|
+
|
34
|
+
After running the generator and migrating, open config/initializers/betsy.rb and set your API key and redirect url to the correct values.
|
35
|
+
|
36
|
+
Now Betsy should be configured for use.
|
37
|
+
|
38
|
+
### Getting Authenticated
|
39
|
+
To begin going through the authentication process you will first start by using Betsy to generate an authorization URL:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
Betsy.authorization_url
|
43
|
+
```
|
44
|
+
|
45
|
+
By default `authorization_url` requests access for all scopes, if you would prefer more restrictive scopes can also be passed to `authorization_url` like so:
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
Betsy.authorization_url(scope: ["address_r", "address_w"])
|
49
|
+
```
|
50
|
+
|
51
|
+
Going to the URL generated by `authorization_url` will ask the user to grant access to their account. Then they will be redirected back to your site. This will update the `EtsyAccount` with the `access_token` and `refresh_token`.
|
52
|
+
|
53
|
+
### Making Unauthenticated API Requests
|
54
|
+
|
55
|
+
Betsy is made to mimic [Etsy's API](https://developers.etsy.com/documentation/reference). To make a call you will use the Betsy class for that category, i.e. for `ShopListing Inventory` the class would be `Betsy::ShopListingInventory`. All the methods listed in the Etsy documentation are available to use by calling that method on the category class following proper Ruby syntax, i.e. `Betsy::ShopListingInventory.get_listing_inventory`. The only parameters for these methods are path parameters, such as `shop_id` or `listing_id` and these are passed in the order in which they appear in the URL. All other parameters can be passed as named parameters. Betsy handles your API key so this does not need to be passed to these methods.
|
56
|
+
|
57
|
+
### Making Authenticated API Requests
|
58
|
+
|
59
|
+
To make an API request that is authenticated follow the instructions above but also pass a named parameter `etsy_account` with an `EtsyAccount` model.
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
Betsy::UserAddress.get_user_addresses(etsy_account: EtsyAccount.first)
|
63
|
+
```
|
64
|
+
|
65
|
+
### Refreshing Access Tokens
|
66
|
+
|
67
|
+
By default, Betsy handles the refreshing of authentication tokens for you.
|
68
|
+
|
69
|
+
## License
|
70
|
+
|
71
|
+
The gem is available as open-source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
72
|
+
|
73
|
+
## Contributing
|
74
|
+
|
75
|
+
If you would like to contribute to this gem feel free to open issues or fork this repository and open a pull request.
|
76
|
+
|
77
|
+
## Special thanks.
|
78
|
+
|
79
|
+
Thanks to [Will](https://github.com/willtcarey) and [Mark](https://github.com/markvanlan) for answering my endless supply of questions when creating this gem.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Etsy Account Linked
|
data/betsy-0.1.0.gem
ADDED
Binary file
|
data/betsy.gemspec
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/betsy/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "betsy"
|
7
|
+
spec.version = Betsy::VERSION
|
8
|
+
spec.authors = ["Jace Bayless"]
|
9
|
+
spec.email = ["jacebayless@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "A gem for the Etsy API V3"
|
12
|
+
spec.description = "This gem allows users to simply interact with the Etsy V3 API."
|
13
|
+
spec.homepage = "https://github.com/JaceBayless/betsy"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
16
|
+
|
17
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
18
|
+
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
spec.metadata["source_code_uri"] = "https://github.com/JaceBayless/betsy"
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/JaceBayless/betsy/blob/main/CHANGELOG.md"
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
27
|
+
end
|
28
|
+
spec.bindir = "exe"
|
29
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
spec.add_development_dependency("rails")
|
33
|
+
spec.add_development_dependency("rake")
|
34
|
+
spec.add_development_dependency("standard", "~> 1.1.7")
|
35
|
+
spec.add_development_dependency("rspec", "~> 3.10")
|
36
|
+
spec.add_development_dependency("sqlite3")
|
37
|
+
spec.add_development_dependency("webmock", "~> 3.13.0")
|
38
|
+
spec.add_development_dependency("coveralls")
|
39
|
+
|
40
|
+
spec.add_dependency("faraday", "1.5.1")
|
41
|
+
|
42
|
+
# For more information and examples about making a new gem, checkout our
|
43
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
44
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "betsy"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/config/routes.rb
ADDED
data/lib/betsy/engine.rb
ADDED
data/lib/betsy/error.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Betsy
|
4
|
+
class LedgerEntry
|
5
|
+
include Betsy::Model
|
6
|
+
|
7
|
+
attribute :entry_id
|
8
|
+
attribute :ledger_id
|
9
|
+
attribute :sequence_number
|
10
|
+
attribute :amount
|
11
|
+
attribute :currency
|
12
|
+
attribute :description
|
13
|
+
attribute :balance
|
14
|
+
attribute :create_date
|
15
|
+
|
16
|
+
def self.get_shop_payment_account_ledger_entries(shop_id, options = {})
|
17
|
+
make_request(:get, "/v3/application/shops/#{shop_id}/payment-account/ledger-entries", options)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|