fera-api 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/.idea/fera-api.iml +86 -0
  3. data/.idea/modules.xml +8 -0
  4. data/.idea/vcs.xml +6 -0
  5. data/.idea/workspace.xml +91 -0
  6. data/.rspec +3 -0
  7. data/.rubocop.yml +56 -0
  8. data/Gemfile +14 -0
  9. data/Gemfile.lock +92 -0
  10. data/LICENSE.txt +21 -0
  11. data/README.md +256 -0
  12. data/Rakefile +12 -0
  13. data/lib/fera/api/version.rb +7 -0
  14. data/lib/fera/api.rb +69 -0
  15. data/lib/fera/app.rb +33 -0
  16. data/lib/fera/models/base.rb +374 -0
  17. data/lib/fera/models/collection.rb +26 -0
  18. data/lib/fera/models/concerns/belongs_to_customer.rb +70 -0
  19. data/lib/fera/models/concerns/belongs_to_order.rb +87 -0
  20. data/lib/fera/models/concerns/belongs_to_product.rb +48 -0
  21. data/lib/fera/models/concerns/belongs_to_review.rb +40 -0
  22. data/lib/fera/models/concerns/belongs_to_submission.rb +39 -0
  23. data/lib/fera/models/concerns/has_many_orders.rb +30 -0
  24. data/lib/fera/models/concerns/has_many_reviews.rb +30 -0
  25. data/lib/fera/models/concerns/has_many_submissions.rb +30 -0
  26. data/lib/fera/models/concerns/has_media.rb +95 -0
  27. data/lib/fera/models/concerns/has_subject.rb +44 -0
  28. data/lib/fera/models/customer.rb +8 -0
  29. data/lib/fera/models/media.rb +55 -0
  30. data/lib/fera/models/order.rb +5 -0
  31. data/lib/fera/models/photo.rb +5 -0
  32. data/lib/fera/models/product.rb +12 -0
  33. data/lib/fera/models/rating.rb +9 -0
  34. data/lib/fera/models/review.rb +18 -0
  35. data/lib/fera/models/store.rb +11 -0
  36. data/lib/fera/models/submission.rb +19 -0
  37. data/lib/fera/models/video.rb +5 -0
  38. data/lib/fera/models/webhook.rb +4 -0
  39. data/lib/fera.rb +4 -0
  40. metadata +167 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 83807e83ab901ad55674c52bad255fbdd28f3b836d3f0f0cec9e6d89706c7b9a
4
+ data.tar.gz: 95ef78772948857fa52d558e2fe41d40d733ebaf98c9758ecb51629526108ef9
5
+ SHA512:
6
+ metadata.gz: c3c2d2272a78519eec6fe20f44a34604cbd52de17147f9c1fcd258534e0a852e40be5b454bcfe4c960c818341ceda9083bbd41af0af4e1b74cddc61fc1a4296a
7
+ data.tar.gz: d678db7fd72623971f81da4d6a7ce6be13ce46dc486ba061f233008b8cb115360a54dc05bc169b4de3d8f9b20eac1b2106e8833b9d91f624e3b43ab343c5df9d
@@ -0,0 +1,86 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$">
8
+ <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
+ </content>
12
+ <orderEntry type="jdk" jdkName="rbenv: 2.7.6" jdkType="RUBY_SDK" />
13
+ <orderEntry type="sourceFolder" forTests="false" />
14
+ <orderEntry type="library" scope="PROVIDED" name="activemodel (v6.1.6, rbenv: 2.7.6) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="activemodel-serializers-xml (v1.0.2, rbenv: 2.7.6) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="activeresource (v6.0.0, rbenv: 2.7.6) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="activesupport (v6.1.6, rbenv: 2.7.6) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="aes_key_wrap (v1.1.0, rbenv: 2.7.6) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, rbenv: 2.7.6) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="bindata (v2.4.10, rbenv: 2.7.6) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="builder (v3.2.4, rbenv: 2.7.6) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.3.13, rbenv: 2.7.6) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.10, rbenv: 2.7.6) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.0, rbenv: 2.7.6) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="i18n (v1.10.0, rbenv: 2.7.6) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="json-jwt (v1.13.0, rbenv: 2.7.6) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="minitest (v5.16.0, rbenv: 2.7.6) [gem]" level="application" />
28
+ <orderEntry type="library" scope="PROVIDED" name="parallel (v1.22.1, rbenv: 2.7.6) [gem]" level="application" />
29
+ <orderEntry type="library" scope="PROVIDED" name="parser (v3.1.2.0, rbenv: 2.7.6) [gem]" level="application" />
30
+ <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, rbenv: 2.7.6) [gem]" level="application" />
31
+ <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, rbenv: 2.7.6) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.4.0, rbenv: 2.7.6) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="require_all (v3.0.0, rbenv: 2.7.6) [gem]" level="application" />
34
+ <orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, rbenv: 2.7.6) [gem]" level="application" />
35
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.11.0, rbenv: 2.7.6) [gem]" level="application" />
36
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.11.0, rbenv: 2.7.6) [gem]" level="application" />
37
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.11.0, rbenv: 2.7.6) [gem]" level="application" />
38
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.11.1, rbenv: 2.7.6) [gem]" level="application" />
39
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.11.0, rbenv: 2.7.6) [gem]" level="application" />
40
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v1.29.0, rbenv: 2.7.6) [gem]" level="application" />
41
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.17.0, rbenv: 2.7.6) [gem]" level="application" />
42
+ <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, rbenv: 2.7.6) [gem]" level="application" />
43
+ <orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.4, rbenv: 2.7.6) [gem]" level="application" />
44
+ <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.1.0, rbenv: 2.7.6) [gem]" level="application" />
45
+ <orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.5.4, rbenv: 2.7.6) [gem]" level="application" />
46
+ </component>
47
+ <component name="RakeTasksCache">
48
+ <option name="myRootTask">
49
+ <RakeTaskImpl id="rake">
50
+ <subtasks>
51
+ <RakeTaskImpl description="Build fera-api-0.1.0.gem into the pkg directory" fullCommand="build" id="build" />
52
+ <RakeTaskImpl id="build">
53
+ <subtasks>
54
+ <RakeTaskImpl description="Generate SHA512 checksum if fera-api-0.1.0.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
55
+ </subtasks>
56
+ </RakeTaskImpl>
57
+ <RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
58
+ <RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
59
+ <RakeTaskImpl description="Build and install fera-api-0.1.0.gem into system gems" fullCommand="install" id="install" />
60
+ <RakeTaskImpl id="install">
61
+ <subtasks>
62
+ <RakeTaskImpl description="Build and install fera-api-0.1.0.gem into system gems without network access" fullCommand="install:local" id="local" />
63
+ </subtasks>
64
+ </RakeTaskImpl>
65
+ <RakeTaskImpl description="Create tag v0.1.0 and build and push fera-api-0.1.0.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
66
+ <RakeTaskImpl description="Run RuboCop" fullCommand="rubocop" id="rubocop" />
67
+ <RakeTaskImpl id="rubocop">
68
+ <subtasks>
69
+ <RakeTaskImpl description="Auto-correct RuboCop offenses" fullCommand="rubocop:auto_correct" id="auto_correct" />
70
+ </subtasks>
71
+ </RakeTaskImpl>
72
+ <RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
73
+ <RakeTaskImpl description="" fullCommand="default" id="default" />
74
+ <RakeTaskImpl description="" fullCommand="release" id="release" />
75
+ <RakeTaskImpl id="release">
76
+ <subtasks>
77
+ <RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
78
+ <RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
79
+ <RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
80
+ </subtasks>
81
+ </RakeTaskImpl>
82
+ </subtasks>
83
+ </RakeTaskImpl>
84
+ </option>
85
+ </component>
86
+ </module>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/fera-api.iml" filepath="$PROJECT_DIR$/.idea/fera-api.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,91 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="009b0e7e-780b-4a53-b5af-225beb092db6" name="Changes" comment="">
5
+ <change afterPath="$PROJECT_DIR$/.github/workflows/checks.yml" afterDir="false" />
6
+ <change afterPath="$PROJECT_DIR$/lib/fera/models/concerns/has_subject.rb" afterDir="false" />
7
+ <change beforePath="$PROJECT_DIR$/.github/workflows/main.yml" beforeDir="false" />
8
+ <change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
9
+ <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
10
+ <change beforePath="$PROJECT_DIR$/.rubocop.yml" beforeDir="false" afterPath="$PROJECT_DIR$/.rubocop.yml" afterDir="false" />
11
+ <change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
12
+ <change beforePath="$PROJECT_DIR$/fera-api.gemspec" beforeDir="false" afterPath="$PROJECT_DIR$/fera-api.gemspec" afterDir="false" />
13
+ <change beforePath="$PROJECT_DIR$/lib/fera/api.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/fera/api.rb" afterDir="false" />
14
+ <change beforePath="$PROJECT_DIR$/lib/fera/models/base.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/fera/models/base.rb" afterDir="false" />
15
+ <change beforePath="$PROJECT_DIR$/lib/fera/models/media.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/fera/models/media.rb" afterDir="false" />
16
+ <change beforePath="$PROJECT_DIR$/lib/fera/models/product_rating.rb" beforeDir="false" />
17
+ <change beforePath="$PROJECT_DIR$/lib/fera/models/rating.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/fera/models/rating.rb" afterDir="false" />
18
+ <change beforePath="$PROJECT_DIR$/lib/fera/models/review.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/fera/models/review.rb" afterDir="false" />
19
+ </list>
20
+ <option name="SHOW_DIALOG" value="false" />
21
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
22
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
23
+ <option name="LAST_RESOLUTION" value="IGNORE" />
24
+ </component>
25
+ <component name="Git.Settings">
26
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
27
+ </component>
28
+ <component name="MarkdownSettingsMigration">
29
+ <option name="stateVersion" value="1" />
30
+ </component>
31
+ <component name="ProjectId" id="2CUN8QyrfMp0BzU6I2ao6g1dJ5J" />
32
+ <component name="ProjectLevelVcsManager">
33
+ <ConfirmationsSetting value="1" id="Add" />
34
+ </component>
35
+ <component name="ProjectViewState">
36
+ <option name="autoscrollFromSource" value="true" />
37
+ <option name="autoscrollToSource" value="true" />
38
+ <option name="hideEmptyMiddlePackages" value="true" />
39
+ <option name="showLibraryContents" value="true" />
40
+ </component>
41
+ <component name="PropertiesComponent"><![CDATA[{
42
+ "keyToString": {
43
+ "ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
44
+ "RunOnceActivity.OpenProjectViewOnStart": "true",
45
+ "RunOnceActivity.ShowReadmeOnStart": "true",
46
+ "last_opened_file_path": "/Users/jay.el-kaake/Sites/wf/bananastand/sdks/ruby/fera-api/.github",
47
+ "nodejs_package_manager_path": "npm",
48
+ "ruby.rails.projectView.checked": "true"
49
+ }
50
+ }]]></component>
51
+ <component name="RecentsManager">
52
+ <key name="CopyFile.RECENT_KEYS">
53
+ <recent name="$PROJECT_DIR$/.github" />
54
+ <recent name="$PROJECT_DIR$/lib/fera/models/concerns" />
55
+ </key>
56
+ <key name="MoveFile.RECENT_KEYS">
57
+ <recent name="$PROJECT_DIR$/lib/fera/models" />
58
+ <recent name="$PROJECT_DIR$/lib/fera/api" />
59
+ <recent name="$PROJECT_DIR$/lib/fera/models/concerns" />
60
+ <recent name="$PROJECT_DIR$/lib/fera" />
61
+ </key>
62
+ </component>
63
+ <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
64
+ <component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" RAKE_SPRING_PRE_LOADER_OPTION="true" RAILS_SPRING_PRE_LOADER_OPTION="true" />
65
+ <component name="TaskManager">
66
+ <task active="true" id="Default" summary="Default task">
67
+ <changelist id="009b0e7e-780b-4a53-b5af-225beb092db6" name="Changes" comment="" />
68
+ <created>1658853043250</created>
69
+ <option name="number" value="Default" />
70
+ <option name="presentableId" value="Default" />
71
+ <updated>1658853043250</updated>
72
+ <workItem from="1658853044517" duration="2379000" />
73
+ <workItem from="1658882747177" duration="20940000" />
74
+ </task>
75
+ <servers />
76
+ </component>
77
+ <component name="TypeScriptGeneratedFilesManager">
78
+ <option name="version" value="3" />
79
+ </component>
80
+ <component name="Vcs.Log.Tabs.Properties">
81
+ <option name="TAB_STATES">
82
+ <map>
83
+ <entry key="MAIN">
84
+ <value>
85
+ <State />
86
+ </value>
87
+ </entry>
88
+ </map>
89
+ </option>
90
+ </component>
91
+ </project>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,56 @@
1
+ Style/StringLiterals:
2
+ Enabled: true
3
+ EnforcedStyle: double_quotes
4
+ Style/StringLiteralsInInterpolation:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+ Style/FrozenStringLiteralComment:
8
+ Enabled: false
9
+ Layout/LeadingCommentSpace:
10
+ Enabled: false
11
+ Layout/LineLength:
12
+ Max: 200
13
+ # If AbcSize > 50, really really really really really really really complex
14
+ Metrics/AbcSize:
15
+ Max: 50
16
+ # Use the default setting
17
+ Metrics/BlockNesting:
18
+ Enabled: true
19
+ Metrics/BlockLength:
20
+ Max: 200
21
+ Exclude:
22
+ # RuboCop's default
23
+ - 'Rakefile'
24
+ - '**/*.rake'
25
+ - 'spec/**/*.rb'
26
+ # In many cases, config/routes.rb has very long blocks
27
+ - 'config/routes.rb'
28
+ Metrics/ClassLength:
29
+ Enabled: false
30
+ Metrics/CyclomaticComplexity:
31
+ Max: 30
32
+ Metrics/MethodLength:
33
+ Enabled: false
34
+ Metrics/ModuleLength:
35
+ Enabled: false
36
+ Metrics/ParameterLists:
37
+ Enabled: true
38
+ Max: 4
39
+ Metrics/PerceivedComplexity:
40
+ Enabled: false
41
+ Layout/TrailingEmptyLines:
42
+ Enabled: false
43
+ Layout/TrailingWhitespace:
44
+ Enabled: false
45
+ Layout/BlockAlignment:
46
+ Enabled: false
47
+ Layout/DefEndAlignment:
48
+ Enabled: false
49
+ Layout/EndAlignment:
50
+ Enabled: false
51
+ Layout/ClosingHeredocIndentation:
52
+ Enabled: false
53
+ Layout/LeadingEmptyLines:
54
+ Enabled: false
55
+ Layout/SpaceInsideStringInterpolation:
56
+ EnforcedStyle: space
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in fera.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ group :development, :test do
11
+ gem "rspec", "~> 3.0"
12
+
13
+ gem "rubocop"
14
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,92 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ fera-api (0.1.0)
5
+ activemodel (>= 4)
6
+ activeresource (>= 6)
7
+ activesupport (>= 5.0)
8
+ json-jwt (>= 1)
9
+ require_all (>= 2)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ activemodel (6.1.6)
15
+ activesupport (= 6.1.6)
16
+ activemodel-serializers-xml (1.0.2)
17
+ activemodel (> 5.x)
18
+ activesupport (> 5.x)
19
+ builder (~> 3.1)
20
+ activeresource (6.0.0)
21
+ activemodel (>= 6.0)
22
+ activemodel-serializers-xml (~> 1.0)
23
+ activesupport (>= 6.0)
24
+ activesupport (6.1.6)
25
+ concurrent-ruby (~> 1.0, >= 1.0.2)
26
+ i18n (>= 1.6, < 2)
27
+ minitest (>= 5.1)
28
+ tzinfo (~> 2.0)
29
+ zeitwerk (~> 2.3)
30
+ aes_key_wrap (1.1.0)
31
+ ast (2.4.2)
32
+ bindata (2.4.10)
33
+ builder (3.2.4)
34
+ concurrent-ruby (1.1.10)
35
+ diff-lcs (1.5.0)
36
+ i18n (1.10.0)
37
+ concurrent-ruby (~> 1.0)
38
+ json-jwt (1.13.0)
39
+ activesupport (>= 4.2)
40
+ aes_key_wrap
41
+ bindata
42
+ minitest (5.16.0)
43
+ parallel (1.22.1)
44
+ parser (3.1.2.0)
45
+ ast (~> 2.4.1)
46
+ rainbow (3.1.1)
47
+ rake (13.0.6)
48
+ regexp_parser (2.4.0)
49
+ require_all (3.0.0)
50
+ rexml (3.2.5)
51
+ rspec (3.11.0)
52
+ rspec-core (~> 3.11.0)
53
+ rspec-expectations (~> 3.11.0)
54
+ rspec-mocks (~> 3.11.0)
55
+ rspec-core (3.11.0)
56
+ rspec-support (~> 3.11.0)
57
+ rspec-expectations (3.11.0)
58
+ diff-lcs (>= 1.2.0, < 2.0)
59
+ rspec-support (~> 3.11.0)
60
+ rspec-mocks (3.11.1)
61
+ diff-lcs (>= 1.2.0, < 2.0)
62
+ rspec-support (~> 3.11.0)
63
+ rspec-support (3.11.0)
64
+ rubocop (1.29.0)
65
+ parallel (~> 1.10)
66
+ parser (>= 3.1.0.0)
67
+ rainbow (>= 2.2.2, < 4.0)
68
+ regexp_parser (>= 1.8, < 3.0)
69
+ rexml (>= 3.2.5, < 4.0)
70
+ rubocop-ast (>= 1.17.0, < 2.0)
71
+ ruby-progressbar (~> 1.7)
72
+ unicode-display_width (>= 1.4.0, < 3.0)
73
+ rubocop-ast (1.17.0)
74
+ parser (>= 3.1.1.0)
75
+ ruby-progressbar (1.11.0)
76
+ tzinfo (2.0.4)
77
+ concurrent-ruby (~> 1.0)
78
+ unicode-display_width (2.1.0)
79
+ zeitwerk (2.5.4)
80
+
81
+ PLATFORMS
82
+ x86_64-darwin-18
83
+ x86_64-darwin-20
84
+
85
+ DEPENDENCIES
86
+ fera-api!
87
+ rake (~> 13.0)
88
+ rspec (~> 3.0)
89
+ rubocop
90
+
91
+ BUNDLED WITH
92
+ 2.3.13
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Jay El-Kaake
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,256 @@
1
+ # Introduction
2
+
3
+ Welcome to the Fera API gem for Ruby. This gem is Fera's official Ruby SDK and make it easy to interact with the Fera API.
4
+
5
+ Fera API Developer Docs and API Reference can be found at: [https://developers.fera.ai](developers.fera.ai)
6
+
7
+ # Installation
8
+
9
+ Install the gem and add to the application's Gemfile by executing:
10
+
11
+ ```ruby
12
+ gem 'fera', '~> 0.1'
13
+ ```
14
+
15
+ # Configuration
16
+ The Fera::API gem accepts 2 [both Secret/API Key authentication](https://developers.fera.ai/docs/api-key-authentication)
17
+ to authenticate against your own Fera store/account, or
18
+ [Auth Token authentication](https://developers.fera.ai/docs/partners-app-authentication) to authenticate against a Fera
19
+ store/account that you have access to with your Fera App.
20
+
21
+ You can learn more about how to obtain your API key or obtain an auth token in our [developer docs](https://developers.fera.ai).
22
+
23
+ ## Configuring for your own Fera store/account
24
+ Assuming you're using the `dotenv` gem (recommended) simply set the `FERA_SECRET_KEY` env variable to your store's
25
+ secret key, then run:
26
+ ```ruby
27
+ Fera::API.configure(ENV['FERA_SECRET_KEY'])
28
+ ```
29
+
30
+ If you're not using the `dotenv` then just run `Fera::API.configure("sk_your_secret_key")` directly.
31
+
32
+ ## Rails Setup
33
+ If you're using rails the best way to configure the gem is to add the following to your `config/initializers/fera.rb`:
34
+
35
+ ```ruby
36
+ Fera::API.configure(ENV['FERA_SECRET_KEY'])
37
+ ```
38
+ (And of course set the ENV variable)
39
+
40
+ ## Configuring as a Fera App
41
+ If you're building a Fera Partner App, you're going to need to authenticate like this instead:
42
+ ```ruby
43
+ Fera::API.configure(store_auth_token) do
44
+ # Some code here that will run against the store which you're authenticated against
45
+ end
46
+ ```
47
+ `store_auth_token` is what you get after successfully completing [OAuth flow for a Fera account/store](https://developers.fera.ai/docs/partners-app-authentication)./
48
+
49
+ This gem also comes with a helper class for working with an app:
50
+ ```ruby
51
+ $fera_app = Fera::App.new(ENV['FERA_CLIENT_ID'], ENV['FERA_CLIENT_SECRET'])
52
+ ```
53
+ We recommend assigning this to a global variable since the methods in the `Fera::App` instance won't vary from Fera
54
+ store/account to store/account.
55
+
56
+
57
+ # Usage
58
+ If you've configured the gem globally because you're only working with 1 store, you can now just call Fera models just
59
+ like you would call a Rails model:
60
+ ```ruby
61
+ Fera::Review.all # Returns collection of reviews.
62
+ ```
63
+
64
+
65
+ ### Partner App Usage
66
+ If you're building an app and want to run a method against a specific store only, you can run the same code but within
67
+ the `Fera::API` block:
68
+ ```ruby
69
+ Fera::API.configure(store_auth_token) do
70
+ Fera::Review.all # Returns collection of reviews.
71
+ end
72
+ ```
73
+ If you're building a partner app on Ruby, you might also want to check out the [Fera OmniAuth Strategy gem](https://github.com/feracommerce/omniauth-fera)
74
+ that will make it easy to connect our app to Fera to get an auth token and start using this API.
75
+
76
+ # Examples
77
+ ## Reviews
78
+ See https://developers.fera.ai/reference/reviews
79
+ ### List all reviews
80
+ ```ruby
81
+ Fera::Review.all # Returns collection of reviews.
82
+ ```
83
+
84
+ ### List a product's reviews
85
+ ```ruby
86
+ Fera::Review.for_product(product_id: "123") # Returns collection of reviews for product with id "123".
87
+ ```
88
+
89
+ ### List a customer's reviews
90
+ ```ruby
91
+ Fera::Review.where(customer_id: "123")
92
+ ```
93
+
94
+ ### Create a review
95
+ ```ruby
96
+ Fera::Review.create(
97
+ product_id: "123",
98
+ rating: 5,
99
+ body: "This is a great product!"
100
+ )
101
+ ```
102
+
103
+ ### Retrieve specific review
104
+ ```ruby
105
+ Fera::Review.find("frev_abc123") # Returns review with id "frev_abc123".
106
+ ```
107
+
108
+ ### Update review
109
+ ```ruby
110
+ review.update(body: "This is a new review body")
111
+ # OR:
112
+ review.body = "This is a new review body"
113
+ review.save!
114
+ ```
115
+
116
+ ### Delete review
117
+ ```ruby
118
+ review.destroy!
119
+ ```
120
+
121
+
122
+ ## Photos and Videos (Media)
123
+ A media object may either be a photo or a video.
124
+
125
+ See https://developers.fera.ai/reference/media
126
+
127
+ ### List all photos and videos
128
+ ```ruby
129
+ Fera::Media.all # Returns collection of reviews.
130
+ ```
131
+
132
+ ### List a product's photos and videos
133
+ ```ruby
134
+ Fera::Media.for_product(product_id: "123") # Returns collection of reviews for product with id "123".
135
+ ```
136
+
137
+ ### Create photo
138
+ ```ruby
139
+ Fera::Photo.create(
140
+ product_id: "123",
141
+ file: "path/to/file",
142
+ caption: "This is my photo."
143
+ )
144
+ ```
145
+
146
+ ### Create video
147
+ ```ruby
148
+ Fera::Video.create(
149
+ product_id: "123",
150
+ file: "path/to/file",
151
+ caption: "This is my video."
152
+ )
153
+ ```
154
+
155
+ ### Retrieve specific photo or video
156
+ ```ruby
157
+ media = Fera::Media.find("fmed_abc123") # Returns photo or video with id "frev_abc123".
158
+ puts "URL to #{ media.is_photo? ? 'photo' : 'video' }: #{ media.url }"
159
+ ```
160
+
161
+ ### Update photo or video
162
+ ```ruby
163
+ media.update(caption: "This is a new media caption")
164
+ # OR:
165
+ media.caption = "This is a new media caption"
166
+ media.save!
167
+ ```
168
+
169
+ ### Delete photo or video
170
+ ```ruby
171
+ media.destroy!
172
+ ```
173
+
174
+
175
+ ## Customers
176
+ See https://developers.fera.ai/reference/customers
177
+
178
+ ### List all customers
179
+ ```ruby
180
+ Fera::Customer.all # Returns collection of customers.
181
+ ```
182
+
183
+ ### Create customer
184
+ ```ruby
185
+ Fera::Customer.create(
186
+ name: "Michael Bluth",
187
+ email: "michael.bluth@example.com",
188
+ external_id: "shopify_customer_1234"
189
+ )
190
+ ```
191
+
192
+ ### Retrieve specific customer
193
+ ```ruby
194
+ Fera::Customer.find("fcus_abc123") # Returns customer with id "fcus_abc123".
195
+ ```
196
+
197
+ ### Update customer
198
+ ```ruby
199
+ customer.update(name: "Tobias Funke")
200
+ # OR:
201
+ customer.name = "Tobias Funke"
202
+ customer.save!
203
+ ```
204
+
205
+ ### Delete customer
206
+ ```ruby
207
+ customer.destroy!
208
+ ```
209
+
210
+ ## Ratings
211
+ See https://developers.fera.ai/reference/ratings
212
+
213
+ ### Retrieve a specific product's rating
214
+ ```ruby
215
+ rating = Fera::Rating.for_product("product_id_1")
216
+ puts "Product has #{ rating.count } reviews with an average rating of #{ rating.average }/5."
217
+ ```
218
+
219
+ ### List a list of product ratings
220
+ ```ruby
221
+ Fera::Rating.for_products(["product_id_1", "product_id_2", "product_id_3"]) # Returns collection of ratings for product with id "123".
222
+ ```
223
+
224
+ ### Retrieve the store's overall rating
225
+ ```ruby
226
+ rating = Fera::Rating.for_store
227
+ puts "This store is rated #{ rating.average }/5 on average by #{ rating.count } customer(s)."
228
+ ```
229
+
230
+
231
+ ## Other resources to check out
232
+ You can use some of the other resources the same way:
233
+ - [Webhooks](https://developers.fera.ai/reference/webhooks)
234
+ - [Store](https://developers.fera.ai/reference/store)
235
+ - [Products](https://developers.fera.ai/reference/products)
236
+
237
+ **See our [developer API reference](https://developers.fera.ai/reference) for all filters, methods and options.**
238
+
239
+ # Contributing
240
+
241
+ Bug reports and pull requests are welcome on GitHub at https://github.com/feracommerce/fera-api-ruby.
242
+
243
+
244
+ ### How to contribute
245
+ To contribute to the repository:
246
+
247
+ 1. Fork the repository.
248
+ 2. Clone the forked repository locally.
249
+ 3. Create a branch descriptive of your work. For example "my_new_feature_xyz".
250
+ 4. When you're done work, push up that branch to **your own forked repository** (not the main one).
251
+ 5. Visit https://github.com/feracommerce/fera-api-ruby and you'll see an option to create a pull request from your forked branch to the master. Create a pull request.
252
+
253
+
254
+ # License
255
+
256
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]