falsify 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.rubocop.yml +123 -0
- data/.travis.yml +7 -0
- data/.yardopts +2 -0
- data/CHANGELOG.md +31 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +75 -0
- data/LICENSE.txt +21 -0
- data/README.md +44 -0
- data/Rakefile +10 -0
- data/bin/console +10 -0
- data/bin/docs +3 -0
- data/bin/setup +8 -0
- data/falsify.gemspec +39 -0
- data/lib/falsify.rb +4 -0
- data/lib/falsify/error.rb +5 -0
- data/lib/falsify/models/address.rb +54 -0
- data/lib/falsify/models/customer/customer.rb +114 -0
- data/lib/falsify/models/customer/metafield.rb +36 -0
- data/lib/falsify/models/fulfillment/fulfillment.rb +96 -0
- data/lib/falsify/models/fulfillment/fulfillment_event.rb +75 -0
- data/lib/falsify/models/fulfillment/fulfillment_line_item.rb +75 -0
- data/lib/falsify/models/fulfillment/supported_tracking_companies.rb +51 -0
- data/lib/falsify/models/order/client_details.rb +36 -0
- data/lib/falsify/models/order/discount_allocation.rb +15 -0
- data/lib/falsify/models/order/discount_application.rb +62 -0
- data/lib/falsify/models/order/discount_code.rb +26 -0
- data/lib/falsify/models/order/order.rb +248 -0
- data/lib/falsify/models/order/order_line_item.rb +102 -0
- data/lib/falsify/models/order/price_set.rb +52 -0
- data/lib/falsify/models/order/refund/refund.rb +72 -0
- data/lib/falsify/models/order/refund/refund_line_item.rb +0 -0
- data/lib/falsify/models/order/shipping_line.rb +39 -0
- data/lib/falsify/models/order/tax_line.rb +14 -0
- data/lib/falsify/models/product/collection/collect.rb +29 -0
- data/lib/falsify/models/product/collection/custom_collection.rb +72 -0
- data/lib/falsify/models/product/collection/smart_collection.rb +181 -0
- data/lib/falsify/models/product/product.rb +83 -0
- data/lib/falsify/models/product/product_image.rb +39 -0
- data/lib/falsify/models/product/product_variant.rb +111 -0
- data/lib/falsify/version.rb +3 -0
- metadata +214 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 020ab0a1975ef2077d0cf69093b94027e9369c61e966424eb715d843993147b5
|
4
|
+
data.tar.gz: d2847d7dccf9e329b40c275dc050507ce8d698c584dddfd31e2dc6461d9ac503
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8e0198b4fd9c23097692322ed110a2a3f9b939c0ed3658012e21c0a841ddadfb46733319aa615ffcf39ddb2cdee24319a63dff7e5d7559bdba32069168ebf25f
|
7
|
+
data.tar.gz: b6d7106ab3315b03671570d01defd09876302f6d971ab2a3e7cb730a30a6036c52b52fc5c949d2fedc929cf1803ebbbb9c5bd71c74319b80435f7b6b2f22a2f7
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.6.0
|
3
|
+
|
4
|
+
Style/Documentation:
|
5
|
+
Enabled: true
|
6
|
+
Exclude:
|
7
|
+
- 'test/**/*.rb'
|
8
|
+
|
9
|
+
Style/DocumentationMethod:
|
10
|
+
Enabled: true
|
11
|
+
Exclude:
|
12
|
+
- 'test/**/*.rb'
|
13
|
+
|
14
|
+
# Don't leave calls to pry lying around.
|
15
|
+
Lint/Debugger:
|
16
|
+
Enabled: true
|
17
|
+
|
18
|
+
Metrics/LineLength:
|
19
|
+
Max: 150
|
20
|
+
|
21
|
+
Style/StringLiterals:
|
22
|
+
EnforcedStyle: double_quotes
|
23
|
+
|
24
|
+
Style/FrozenStringLiteralComment:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Naming/HeredocDelimiterNaming:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
# Only use braces if the function expects a hash argument. [different in Ruby 2.7+](https://blog.saeloun.com/2019/10/07/ruby-2-7-keyword-arguments-redesign.html)
|
31
|
+
Style/BracesAroundHashParameters:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Layout/IndentFirstHashElement:
|
35
|
+
EnforcedStyle: consistent
|
36
|
+
|
37
|
+
Layout/IndentFirstArrayElement:
|
38
|
+
EnforcedStyle: consistent
|
39
|
+
|
40
|
+
# https://unix.stackexchange.com/a/18789
|
41
|
+
Layout/TrailingBlankLines:
|
42
|
+
EnforcedStyle: final_newline
|
43
|
+
|
44
|
+
Style/TrailingCommaInArguments:
|
45
|
+
EnforcedStyleForMultiline: comma
|
46
|
+
|
47
|
+
Style/TrailingCommaInArrayLiteral:
|
48
|
+
EnforcedStyleForMultiline: comma
|
49
|
+
|
50
|
+
Style/TrailingCommaInHashLiteral:
|
51
|
+
EnforcedStyleForMultiline: comma
|
52
|
+
|
53
|
+
Layout/EmptyLineAfterGuardClause:
|
54
|
+
Enabled: false
|
55
|
+
|
56
|
+
Style/DefWithParentheses:
|
57
|
+
Enabled: false
|
58
|
+
|
59
|
+
Style/MethodCallWithoutArgsParentheses:
|
60
|
+
Enabled: false
|
61
|
+
|
62
|
+
# Explicit, not redundant
|
63
|
+
Style/RedundantReturn:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
# Explicit, not redundant
|
67
|
+
Style/RedundantSelf:
|
68
|
+
Enabled: false
|
69
|
+
|
70
|
+
# Use of `&` with bracket access isn't what I'd call "readable".
|
71
|
+
Style/SafeNavigation:
|
72
|
+
Enabled: false
|
73
|
+
|
74
|
+
Style/WordArray:
|
75
|
+
EnforcedStyle: brackets
|
76
|
+
|
77
|
+
Style/SymbolArray:
|
78
|
+
EnforcedStyle: brackets
|
79
|
+
|
80
|
+
# TODO: File issue to ignore ternary statements when using `EnforcedStyle: assign_inside_condition`.
|
81
|
+
Style/ConditionalAssignment:
|
82
|
+
# EnforcedStyle: assign_inside_condition
|
83
|
+
# EnforcedStyle: assign_to_condition
|
84
|
+
Enabled: false
|
85
|
+
|
86
|
+
Lint/HandleExceptions:
|
87
|
+
AllowComments: true
|
88
|
+
|
89
|
+
Metrics/BlockLength:
|
90
|
+
Enabled: false
|
91
|
+
|
92
|
+
Metrics/ClassLength:
|
93
|
+
Enabled: false
|
94
|
+
|
95
|
+
Metrics/ModuleLength:
|
96
|
+
Enabled: false
|
97
|
+
|
98
|
+
Metrics/MethodLength:
|
99
|
+
Enabled: false
|
100
|
+
|
101
|
+
Metrics/AbcSize:
|
102
|
+
Enabled: false
|
103
|
+
|
104
|
+
Metrics/CyclomaticComplexity:
|
105
|
+
Enabled: false
|
106
|
+
|
107
|
+
Metrics/PerceivedComplexity:
|
108
|
+
Enabled: false
|
109
|
+
|
110
|
+
Layout/EmptyLinesAroundBlockBody:
|
111
|
+
Enabled: false
|
112
|
+
|
113
|
+
Style/ZeroLengthPredicate:
|
114
|
+
Enabled: false
|
115
|
+
|
116
|
+
Style/NumericPredicate:
|
117
|
+
Enabled: false
|
118
|
+
|
119
|
+
Style/CommentedKeyword:
|
120
|
+
Enabled: False
|
121
|
+
|
122
|
+
Naming/VariableNumber:
|
123
|
+
EnforcedStyle: snake_case
|
data/.travis.yml
ADDED
data/.yardopts
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 0.1.0 (2019-11-25)
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- Classes modeling the following resources:
|
8
|
+
- Address
|
9
|
+
- Customer
|
10
|
+
- Metafield
|
11
|
+
- Fulfillment
|
12
|
+
- Fulfillment Event
|
13
|
+
- Fulfillment Line Item
|
14
|
+
- Supported Tracking Companies
|
15
|
+
- Client Details
|
16
|
+
- Discount Allocation
|
17
|
+
- Discount Application
|
18
|
+
- Discount Code
|
19
|
+
- Order
|
20
|
+
- Order Line Item
|
21
|
+
- Price Set
|
22
|
+
- Refund
|
23
|
+
- Refund Line Item
|
24
|
+
- Shipping Line
|
25
|
+
- Tax Line
|
26
|
+
- Product
|
27
|
+
- Product Image
|
28
|
+
- Product Variant
|
29
|
+
- Collect
|
30
|
+
- Custom Collection
|
31
|
+
- Smart Collection
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
falsify (0.1.0)
|
5
|
+
enumerize (~> 2.2.2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (6.0.1)
|
11
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
+
i18n (>= 0.7, < 2)
|
13
|
+
minitest (~> 5.1)
|
14
|
+
tzinfo (~> 1.1)
|
15
|
+
zeitwerk (~> 2.2)
|
16
|
+
ansi (1.5.0)
|
17
|
+
builder (3.2.3)
|
18
|
+
coderay (1.1.2)
|
19
|
+
concurrent-ruby (1.1.5)
|
20
|
+
coveralls (0.8.23)
|
21
|
+
json (>= 1.8, < 3)
|
22
|
+
simplecov (~> 0.16.1)
|
23
|
+
term-ansicolor (~> 1.3)
|
24
|
+
thor (>= 0.19.4, < 2.0)
|
25
|
+
tins (~> 1.6)
|
26
|
+
docile (1.3.2)
|
27
|
+
enumerize (2.2.2)
|
28
|
+
activesupport (>= 3.2)
|
29
|
+
i18n (1.7.0)
|
30
|
+
concurrent-ruby (~> 1.0)
|
31
|
+
json (2.2.0)
|
32
|
+
method_source (0.9.2)
|
33
|
+
minitest (5.13.0)
|
34
|
+
minitest-focus (1.1.2)
|
35
|
+
minitest (>= 4, < 6)
|
36
|
+
minitest-reporters (1.4.2)
|
37
|
+
ansi
|
38
|
+
builder
|
39
|
+
minitest (>= 5.0)
|
40
|
+
ruby-progressbar
|
41
|
+
pry (0.12.2)
|
42
|
+
coderay (~> 1.1.0)
|
43
|
+
method_source (~> 0.9.0)
|
44
|
+
rake (10.5.0)
|
45
|
+
ruby-progressbar (1.10.1)
|
46
|
+
simplecov (0.16.1)
|
47
|
+
docile (~> 1.1)
|
48
|
+
json (>= 1.8, < 3)
|
49
|
+
simplecov-html (~> 0.10.0)
|
50
|
+
simplecov-html (0.10.2)
|
51
|
+
term-ansicolor (1.7.1)
|
52
|
+
tins (~> 1.0)
|
53
|
+
thor (0.20.3)
|
54
|
+
thread_safe (0.3.6)
|
55
|
+
tins (1.22.2)
|
56
|
+
tzinfo (1.2.5)
|
57
|
+
thread_safe (~> 0.1)
|
58
|
+
zeitwerk (2.2.1)
|
59
|
+
|
60
|
+
PLATFORMS
|
61
|
+
ruby
|
62
|
+
|
63
|
+
DEPENDENCIES
|
64
|
+
bundler (~> 2.0)
|
65
|
+
coveralls (~> 0.8.23)
|
66
|
+
falsify!
|
67
|
+
minitest (~> 5.8)
|
68
|
+
minitest-focus (~> 1.1)
|
69
|
+
minitest-reporters (~> 1.4)
|
70
|
+
pry (~> 0.12.2)
|
71
|
+
rake (~> 10.0)
|
72
|
+
simplecov
|
73
|
+
|
74
|
+
BUNDLED WITH
|
75
|
+
2.0.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Clay Dunston
|
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,44 @@
|
|
1
|
+
# Falsify
|
2
|
+
|
3
|
+
![Shopify API Version](https://img.shields.io/badge/Shopify_API-2019--10-brightgreen.svg)
|
4
|
+
[![Build Status](https://travis-ci.org/tcd/falsify.svg?branch=master)](https://travis-ci.org/tcd/falsify)
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/github/tcd/falsify/badge.svg?branch=master)](https://coveralls.io/github/tcd/falsify?branch=master)
|
6
|
+
[![Inline docs](http://inch-ci.org/github/tcd/falsify.svg?branch=master)](http://inch-ci.org/github/tcd/falsify)
|
7
|
+
[![Documentation](http://img.shields.io/badge/docs-rubydoc.org-blue.svg)](https://rubydoc.org/github/tcd/falsify/master)
|
8
|
+
|
9
|
+
Models for Shopify resources (WIP).
|
10
|
+
|
11
|
+
Can be used with the [shopify_api gem](https://github.com/Shopify/shopify_api), which doesn't itself provide any documentation on the resources it wraps.
|
12
|
+
|
13
|
+
Also has methods that use [faker](https://github.com/faker-ruby/faker) to generate fake Shopify data.
|
14
|
+
Could be useful to for populating product, customer, order, etc. data for a development store to test against.
|
15
|
+
|
16
|
+
Enum values are represented using [enumerize](https://github.com/brainspec/enumerize), so they will work without Rails,
|
17
|
+
but are also compatible with [ActiveRecord enums](https://api.rubyonrails.org/v6.0.0/classes/ActiveRecord/Enum.html).
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
Add this line to your application's Gemfile:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
gem 'falsify'
|
25
|
+
```
|
26
|
+
|
27
|
+
And then execute:
|
28
|
+
|
29
|
+
```sh
|
30
|
+
bundle
|
31
|
+
```
|
32
|
+
Or install it yourself as:
|
33
|
+
|
34
|
+
```sh
|
35
|
+
gem install falsify
|
36
|
+
```
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/tcd/falsify.
|
41
|
+
|
42
|
+
## License
|
43
|
+
|
44
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
data/bin/docs
ADDED
data/bin/setup
ADDED
data/falsify.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "falsify/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "falsify"
|
7
|
+
spec.version = Falsify::VERSION
|
8
|
+
spec.authors = ["Clay Dunston"]
|
9
|
+
spec.email = ["dunstontc@gmail.com"]
|
10
|
+
spec.summary = "Shopify resources (WIP)"
|
11
|
+
spec.description = spec.summary
|
12
|
+
spec.homepage = "https://github.com/tcd/falsify"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.metadata = {
|
16
|
+
"homepage_uri" => spec.homepage,
|
17
|
+
"source_code_uri" => spec.homepage,
|
18
|
+
"changelog_uri" => "https://github.com/tcd/falsify/blob/master/CHANGELOG.md",
|
19
|
+
"yard.run" => "yri", # use "yard" to build full HTML docs.
|
20
|
+
}
|
21
|
+
|
22
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
23
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
+
end
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
30
|
+
spec.add_development_dependency "coveralls", "~> 0.8.23"
|
31
|
+
spec.add_development_dependency "minitest", "~> 5.8"
|
32
|
+
spec.add_development_dependency "minitest-focus", "~> 1.1"
|
33
|
+
spec.add_development_dependency "minitest-reporters", "~> 1.4"
|
34
|
+
spec.add_development_dependency "pry", "~> 0.12.2"
|
35
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
36
|
+
spec.add_development_dependency "simplecov"
|
37
|
+
|
38
|
+
spec.add_runtime_dependency "enumerize", "~> 2.2.2" # Issue filed regarding 2.3 - https://github.com/brainspec/enumerize/issues/352
|
39
|
+
end
|
data/lib/falsify.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
module Falsify
|
2
|
+
# Used for:
|
3
|
+
# - Order.billing_address
|
4
|
+
# - Order.shipping_address
|
5
|
+
# - Customer.addresses
|
6
|
+
# - Customer.default_address
|
7
|
+
class Address
|
8
|
+
# The street address of the billing address.
|
9
|
+
# @return [String]
|
10
|
+
attr_accessor :address1
|
11
|
+
# An optional additional field for the street address of the billing address.
|
12
|
+
# @return [String]
|
13
|
+
attr_accessor :address2
|
14
|
+
# The city, town, or village of the billing address.
|
15
|
+
# @return [String]
|
16
|
+
attr_accessor :city
|
17
|
+
# The company of the person associated with the billing address.
|
18
|
+
# @return [String]
|
19
|
+
attr_accessor :company
|
20
|
+
# The name of the country of the billing address.
|
21
|
+
# @return [String]
|
22
|
+
attr_accessor :country
|
23
|
+
# The two-letter code ([ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format) for the country of the billing address.
|
24
|
+
# @return [String]
|
25
|
+
attr_reader :country_code
|
26
|
+
# The first name of the person associated with the payment method.
|
27
|
+
# @return [String]
|
28
|
+
attr_accessor :first_name
|
29
|
+
# The last name of the person associated with the payment method.
|
30
|
+
# @return [String]
|
31
|
+
attr_accessor :last_name
|
32
|
+
# The latitude of the billing address.
|
33
|
+
# @return [String]
|
34
|
+
attr_accessor :latitude
|
35
|
+
# The longitude of the billing address.
|
36
|
+
# @return [String]
|
37
|
+
attr_accessor :longitude
|
38
|
+
# The full name of the person associated with the payment method.
|
39
|
+
# @return [String]
|
40
|
+
attr_accessor :name
|
41
|
+
# The phone number at the billing address.
|
42
|
+
# @return [String]
|
43
|
+
attr_accessor :phone
|
44
|
+
# The name of the region (province, state, prefecture, ...) of the billing address.
|
45
|
+
# @return [String]
|
46
|
+
attr_accessor :province
|
47
|
+
# The two-letter abbreviation of the region of the billing address.
|
48
|
+
# @return [String]
|
49
|
+
attr_accessor :province_code
|
50
|
+
# The postal code (zip, postcode, Eircode, ...) of the billing address.
|
51
|
+
# @return [String]
|
52
|
+
attr_accessor :zip
|
53
|
+
end
|
54
|
+
end
|