fera-api 0.1.0 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,7 +21,6 @@ module Fera
21
21
  end
22
22
  self.attributes['submission_id'] = submission_id
23
23
  self.attributes.delete('submission')
24
- @submission
25
24
  end
26
25
 
27
26
  def submission
@@ -31,8 +30,6 @@ module Fera
31
30
  Submission.new(attributes['submission'], true)
32
31
  elsif attributes.key?('submission_id') && submission_id.present?
33
32
  Submission.find(submission_id)
34
- else
35
- nil
36
33
  end
37
34
  end
38
35
  end
@@ -26,11 +26,9 @@ module Fera
26
26
  # Returns the associated product model if it was preloaded in the original request and if the object is for a product.
27
27
  # @return [::Fera::Product, NilClass]
28
28
  def product
29
- if attributes['subject'] =~ /^product/i
30
- super
31
- else
32
- nil
33
- end
29
+ return nil if attributes['subject'] !~ /^product/i
30
+
31
+ super
34
32
  end
35
33
 
36
34
  def for_product?
@@ -31,25 +31,25 @@ module Fera
31
31
  end
32
32
  alias_method :photo?, :is_photo?
33
33
 
34
- def file=(f)
35
- if f.is_a?(File)
36
- file_name = File.basename(f.path)
34
+ def file=(val)
35
+ if val.is_a?(File)
36
+ file_name = File.basename(val.path)
37
37
  mime_type_group = type == 'video' ? 'video' : 'image'
38
38
  self.attributes['file'] = {
39
39
  'name' => File.basename(file_name),
40
- 'data' => "data:#{ mime_type_group }/#{ file_name.split('.').last };base64,#{ Base64.encode64(f.read) }"
40
+ 'data' => "data:#{ mime_type_group }/#{ file_name.split('.').last };base64,#{ Base64.encode64(val.read) }",
41
41
  }
42
42
  else
43
- self.attributes['file'] = f
43
+ self.attributes['file'] = val
44
44
  end
45
45
  end
46
46
 
47
47
  private
48
48
 
49
49
  def remove_file_param
50
- if self.attributes.key?('file')
51
- self.attributes.delete('file')
52
- end
50
+ return unless self.attributes.key?('file')
51
+
52
+ self.attributes.delete('file')
53
53
  end
54
54
  end
55
55
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fera-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fera Commerce Inc
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-28 00:00:00.000000000 Z
11
+ date: 2022-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activemodel
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '4'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: activeresource
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -25,19 +39,33 @@ dependencies:
25
39
  - !ruby/object:Gem::Version
26
40
  version: '6'
27
41
  - !ruby/object:Gem::Dependency
28
- name: activemodel
42
+ name: activesupport
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - ">="
32
46
  - !ruby/object:Gem::Version
33
- version: '4'
47
+ version: '4.0'
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - ">="
39
53
  - !ruby/object:Gem::Version
40
- version: '4'
54
+ version: '4.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: json-jwt
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '1'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '1'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: require_all
43
71
  requirement: !ruby/object:Gem::Requirement
@@ -53,33 +81,47 @@ dependencies:
53
81
  - !ruby/object:Gem::Version
54
82
  version: '2'
55
83
  - !ruby/object:Gem::Dependency
56
- name: activesupport
84
+ name: pry
57
85
  requirement: !ruby/object:Gem::Requirement
58
86
  requirements:
59
87
  - - ">="
60
88
  - !ruby/object:Gem::Version
61
- version: '5.0'
62
- type: :runtime
89
+ version: '0'
90
+ type: :development
63
91
  prerelease: false
64
92
  version_requirements: !ruby/object:Gem::Requirement
65
93
  requirements:
66
94
  - - ">="
67
95
  - !ruby/object:Gem::Version
68
- version: '5.0'
96
+ version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
- name: json-jwt
98
+ name: pry-byebug
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
101
  - - ">="
74
102
  - !ruby/object:Gem::Version
75
- version: '1'
76
- type: :runtime
103
+ version: '0'
104
+ type: :development
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
108
  - - ">="
81
109
  - !ruby/object:Gem::Version
82
- version: '1'
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry-stack_explorer
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
83
125
  - !ruby/object:Gem::Dependency
84
126
  name: rspec
85
127
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +136,34 @@ dependencies:
94
136
  - - ">="
95
137
  - !ruby/object:Gem::Version
96
138
  version: '3.0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: to_bool
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: webmock
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '3.0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '3.0'
97
167
  description: Fera API SDK gem to make it easy to interact with the Fera API to gather
98
168
  and display customer review, photos and videos.
99
169
  email:
@@ -102,12 +172,14 @@ executables: []
102
172
  extensions: []
103
173
  extra_rdoc_files: []
104
174
  files:
105
- - ".idea/fera-api.iml"
106
- - ".idea/modules.xml"
107
- - ".idea/vcs.xml"
108
- - ".idea/workspace.xml"
109
175
  - ".rspec"
110
176
  - ".rubocop.yml"
177
+ - ".ruby-version"
178
+ - ".spellr.yml"
179
+ - ".spellr_wordlists/english.txt"
180
+ - ".spellr_wordlists/html.txt"
181
+ - ".spellr_wordlists/javascript.txt"
182
+ - ".spellr_wordlists/ruby.txt"
111
183
  - Gemfile
112
184
  - Gemfile.lock
113
185
  - LICENSE.txt
@@ -145,6 +217,7 @@ licenses:
145
217
  - MIT
146
218
  metadata:
147
219
  homepage_uri: https://developers.fera.ai
220
+ rubygems_mfa_required: 'true'
148
221
  post_install_message:
149
222
  rdoc_options: []
150
223
  require_paths:
@@ -153,7 +226,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
153
226
  requirements:
154
227
  - - ">="
155
228
  - !ruby/object:Gem::Version
156
- version: 2.2.0
229
+ version: '2.3'
157
230
  required_rubygems_version: !ruby/object:Gem::Requirement
158
231
  requirements:
159
232
  - - ">="
data/.idea/fera-api.iml DELETED
@@ -1,86 +0,0 @@
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 DELETED
@@ -1,8 +0,0 @@
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 DELETED
@@ -1,6 +0,0 @@
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>
data/.idea/workspace.xml DELETED
@@ -1,91 +0,0 @@
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>