daxtra 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bb44d89f920f2bce4acb31a3af75159896d760b4acf810dfb20cae01cae92aa1
4
+ data.tar.gz: 4b160f19861390a0cb391e6a4f26f29b56e210b74c1d33da8eadeaaf9778e262
5
+ SHA512:
6
+ metadata.gz: 3240cbd94fb1256b13764eb97d5eaaa836507ac53e806f79ed5625a6f2e008d269e4f8f921280c7a794010f6b6f482f247befd275d2ff325480d242e8cd89776
7
+ data.tar.gz: d669855d21675957323432b7bb4402ed623a38f1fa636bd765f087cf60b86ec9601af9eb17e8d366818e7c293d73bccfd14e5c3fc2dff86f5230d607b28c8133
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
4
+ --fail_fast
@@ -0,0 +1,239 @@
1
+ require: rubocop-rspec
2
+
3
+ inherit_mode:
4
+ merge:
5
+ - Exclude
6
+
7
+ AllCops:
8
+ TargetRubyVersion: 2.5
9
+ Exclude:
10
+ - "bin/*"
11
+ - "Rakefile"
12
+ - "spec/spec_helper.rb"
13
+ - "spec/rails_helper.rb"
14
+
15
+
16
+ # === METRICS =================================================================================== #
17
+
18
+ # Commonly used screens these days easily fit more than 80 characters.
19
+ Metrics/LineLength:
20
+ Max: 80
21
+
22
+ # Too short methods lead to extraction of single-use methods, which can make
23
+ # the code easier to read (by naming things), but can also clutter the class
24
+ Metrics/MethodLength:
25
+ Max: 10
26
+
27
+ # The guiding principle of classes is SRP, SRP can't be accurately measured by LoC
28
+ Metrics/ClassLength:
29
+ Max: 100
30
+
31
+ # Avoid writing of large modules
32
+ Metrics/ModuleLength:
33
+ Max: 100
34
+
35
+ # Avoid excessive block nesting
36
+ Metrics/BlockNesting:
37
+ Max: 3
38
+
39
+ # Create separate methods/services to be used within block
40
+ Metrics/BlockLength:
41
+ Max: 3
42
+ Exclude:
43
+ - "daxtra.gemspec"
44
+ - "spec/**/*"
45
+ ExcludedMethods:
46
+ - class_methods
47
+
48
+ # Avoid parameter lists longer than three or four parameters
49
+ # https://github.com/bbatsov/ruby-style-guide#too-many-params
50
+ Metrics/ParameterLists:
51
+ Max: 4
52
+
53
+
54
+ # === LAYOUT ==================================================================================== #
55
+
56
+ # Most readable form.
57
+ Layout/AlignHash:
58
+ EnforcedHashRocketStyle: table
59
+ EnforcedColonStyle: table
60
+
61
+ # Add empty line after all guard clauses
62
+ Layout/EmptyLineAfterGuardClause:
63
+ Enabled: true
64
+
65
+ # Check space around operators
66
+ Layout/SpaceAroundOperators:
67
+ Enabled: true
68
+
69
+ # This cop checks for extra/unnecessary whitespace
70
+ Layout/ExtraSpacing:
71
+ ForceEqualSignAlignment: true
72
+
73
+ # Method chains are indented with 2 spaces
74
+ Layout/MultilineMethodCallIndentation:
75
+ EnforcedStyle: indented
76
+ IndentationWidth: 2
77
+
78
+ # Multi-line expressions with operators are indented with 2 spaces
79
+ Layout/MultilineOperationIndentation:
80
+ EnforcedStyle: indented
81
+ IndentationWidth: 2
82
+
83
+ # Check if tabulations throughout the project are the same: 2 spaces
84
+ Layout/Tab:
85
+ IndentationWidth: 2
86
+
87
+ # === LINT ====================================================================================== #
88
+
89
+ # Suppressing exceptions can be perfectly fine, and be it to avoid to
90
+ # explicitly type nil into the rescue since that's what you want to return,
91
+ # or suppressing LoadError for optional dependencies
92
+ Lint/HandleExceptions:
93
+ Enabled: false
94
+
95
+ # Don't use assignment in conditions
96
+ Lint/AssignmentInCondition:
97
+ AllowSafeAssignment: false
98
+
99
+ # This cop checks for ambiguous operators in the first argument of a method invocation without parentheses.
100
+ Lint/AmbiguousOperator:
101
+ Enabled: false
102
+
103
+ # Shadowing outer local variables with block parameters is often useful
104
+ # to not reinvent a new name for the same thing, it highlights the relation
105
+ # between the outer variable and the parameter. The cases where it's actually
106
+ # confusing are rare, and usually bad for other reasons already, for example
107
+ # because the method is too long.
108
+ Lint/ShadowingOuterLocalVariable:
109
+ Enabled: false
110
+
111
+ # There are valid cases, for example debugging Cucumber steps,
112
+ # also they'll fail CI anyway. Then add those files to exclude
113
+ Lint/Debugger:
114
+ Enabled: true
115
+
116
+ # Inherit errors from StandardError is more typical than from RuntimeError
117
+ Lint/InheritException:
118
+ EnforcedStyle: standard_error
119
+
120
+ # === NAMING ==================================================================================== #
121
+
122
+ # Forbid numbers in variable names
123
+ Naming/VariableNumber:
124
+ EnforcedStyle: non_integer
125
+
126
+ # === RAILS ===================================================================================== #
127
+
128
+ # ActiveSupport provides semantically great methods
129
+ Rails/ActiveSupportAliases:
130
+ Enabled: false
131
+
132
+ # Allow explicitly defined actions under `only/except keys` with controllers
133
+ Rails/LexicallyScopedActionFilter:
134
+ Enabled: false
135
+
136
+ # Avoid usage of `try` in advantage of `&.`
137
+ Rails/SafeNavigation:
138
+ ConvertTry: true
139
+
140
+ # === STYLE ===================================================================================== #
141
+
142
+ # Allow 'ActiveRecord::Base' not to offend rubocop
143
+ Style/ClassAndModuleChildren:
144
+ Enabled: false
145
+
146
+ # Allow private to be inlined in method definitions.
147
+ Style/AccessModifierDeclarations:
148
+ Enabled: false
149
+
150
+ # We do not need to support Ruby 1.9, so this is good to use.
151
+ Style/SymbolArray:
152
+ Enabled: true
153
+
154
+ # Mixing the styles looks just silly.
155
+ Style/HashSyntax:
156
+ EnforcedStyle: ruby19_no_mixed_keys
157
+
158
+ # String#% is by far the least verbose and only object oriented variant.
159
+ Style/FormatString:
160
+ EnforcedStyle: percent
161
+
162
+ # This cop enforces the use of consistent method names from the Enumerable module
163
+ Style/CollectionMethods:
164
+ Enabled: true
165
+
166
+ # Either allow this style or don't. Marking it as safe with parenthesis
167
+ # is silly. Let's try to live without them for now.
168
+ Style/ParenthesesAroundCondition:
169
+ AllowSafeAssignment: false
170
+
171
+ # A specialized exception class will take one or more arguments and construct the message from it.
172
+ # So both variants make sense.
173
+ Style/RaiseArgs:
174
+ Enabled: false
175
+
176
+ # Fail is an alias of raise. Avoid aliases, it's more cognitive load for no gain.
177
+ # The argument that fail should be used to abort the program is wrong too,
178
+ # there's Kernel#abort for that.
179
+ Style/SignalException:
180
+ EnforcedStyle: only_raise
181
+
182
+ # do / end blocks should be used for side effects,
183
+ # methods that run a block for side effects and have
184
+ # a useful return value are rare, assign the return
185
+ # value to a local variable for those cases.
186
+ Style/MethodCalledOnDoEndBlock:
187
+ Enabled: true
188
+
189
+ # This cop enforces consistency between 'return nil' and 'return'
190
+ Style/ReturnNil:
191
+ Enabled: true
192
+
193
+ # This cop checks for the use of strings as keys in hashes. The use of symbols is preferred instead
194
+ Style/StringHashKeys:
195
+ Enabled: true
196
+
197
+ # Enforcing the names of variables? To single letter ones? Just no.
198
+ Style/SingleLineBlockParams:
199
+ Enabled: false
200
+
201
+ # Check with yard instead.
202
+ Style/Documentation:
203
+ Enabled: false
204
+
205
+ # Style preference
206
+ Style/MethodDefParentheses:
207
+ Enabled: false
208
+
209
+ # Frozen Literals
210
+ Style/FrozenStringLiteralComment:
211
+ EnforcedStyle: always
212
+
213
+ # Quotes
214
+ Style/StringLiterals:
215
+ EnforcedStyle: double_quotes
216
+
217
+ # Use unary plus to get an unfrozen string literal.
218
+ Performance/UnfreezeString:
219
+ Enabled: false
220
+
221
+ # Allow us to use `alias_method` in class body
222
+ Style/Alias:
223
+ EnforcedStyle: prefer_alias_method
224
+
225
+ # Allow us to use empty `case`
226
+ Style/EmptyCaseCondition:
227
+ Enabled: false
228
+
229
+ # Prefer `call` over `.()` shortcut
230
+ Style/LambdaCall:
231
+ EnforcedStyle: call
232
+
233
+ # Prefer `%r{}` over `//`. It better plays with slashes
234
+ Style/RegexpLiteral:
235
+ EnforcedStyle: percent_r
236
+
237
+ # Wrap complex conditions in ternary expressions with parentheses
238
+ Style/TernaryParentheses:
239
+ EnforcedStyle: require_parentheses_when_complex
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.0
7
+ before_install: gem install bundler -v 1.17.3
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at andrew.r224@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in daxtra.gemspec
8
+ gemspec
@@ -0,0 +1,86 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ daxtra (0.1.0)
5
+ faraday (~> 0.15.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.6.0)
11
+ public_suffix (>= 2.0.2, < 4.0)
12
+ ast (2.4.0)
13
+ coderay (1.1.2)
14
+ crack (0.4.3)
15
+ safe_yaml (~> 1.0.0)
16
+ diff-lcs (1.3)
17
+ faraday (0.15.4)
18
+ multipart-post (>= 1.2, < 3)
19
+ hashdiff (0.3.8)
20
+ jaro_winkler (1.5.2)
21
+ method_source (0.9.2)
22
+ multipart-post (2.0.0)
23
+ parallel (1.14.0)
24
+ parser (2.6.0.0)
25
+ ast (~> 2.4.0)
26
+ powerpack (0.1.2)
27
+ pry (0.12.2)
28
+ coderay (~> 1.1.0)
29
+ method_source (~> 0.9.0)
30
+ psych (3.1.0)
31
+ public_suffix (3.0.3)
32
+ rack (2.0.6)
33
+ rack-test (1.1.0)
34
+ rack (>= 1.0, < 3)
35
+ rainbow (3.0.0)
36
+ rake (10.5.0)
37
+ rspec (3.8.0)
38
+ rspec-core (~> 3.8.0)
39
+ rspec-expectations (~> 3.8.0)
40
+ rspec-mocks (~> 3.8.0)
41
+ rspec-core (3.8.0)
42
+ rspec-support (~> 3.8.0)
43
+ rspec-expectations (3.8.2)
44
+ diff-lcs (>= 1.2.0, < 2.0)
45
+ rspec-support (~> 3.8.0)
46
+ rspec-mocks (3.8.0)
47
+ diff-lcs (>= 1.2.0, < 2.0)
48
+ rspec-support (~> 3.8.0)
49
+ rspec-support (3.8.0)
50
+ rubocop (0.65.0)
51
+ jaro_winkler (~> 1.5.1)
52
+ parallel (~> 1.10)
53
+ parser (>= 2.5, != 2.5.1.1)
54
+ powerpack (~> 0.1)
55
+ psych (>= 3.1.0)
56
+ rainbow (>= 2.2.2, < 4.0)
57
+ ruby-progressbar (~> 1.7)
58
+ unicode-display_width (~> 1.4.0)
59
+ rubocop-rspec (1.32.0)
60
+ rubocop (>= 0.60.0)
61
+ ruby-progressbar (1.10.0)
62
+ safe_yaml (1.0.5)
63
+ unicode-display_width (1.4.1)
64
+ vcr (4.0.0)
65
+ webmock (3.5.1)
66
+ addressable (>= 2.3.6)
67
+ crack (>= 0.3.2)
68
+ hashdiff
69
+
70
+ PLATFORMS
71
+ ruby
72
+
73
+ DEPENDENCIES
74
+ bundler (~> 1.17)
75
+ daxtra!
76
+ pry (~> 0.12)
77
+ rack-test (~> 1.1)
78
+ rake (~> 10.0)
79
+ rspec (~> 3.0)
80
+ rubocop (~> 0.65)
81
+ rubocop-rspec (~> 1.32)
82
+ vcr (~> 4.0)
83
+ webmock (~> 3.5)
84
+
85
+ BUNDLED WITH
86
+ 1.17.3
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 andrew_r
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.
@@ -0,0 +1,64 @@
1
+ # Daxtra
2
+
3
+ [![Build Status](https://semaphoreci.com/api/v1/andrewr224/daxtra/branches/master/badge.svg)](https://semaphoreci.com/andrewr224/daxtra)
4
+
5
+ Daxtra gem is a minute client for daXtra [REST API](http://cvxdemo.daxtra.com/cvx/#integration-rest) that is used to parse and convert resumes.
6
+
7
+ Learn more about daXtra at their [website](https://www.daxtra.com/).
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'daxtra'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install daxtra
24
+
25
+ ## Usage
26
+
27
+ First, you need to have an account at daXtra; you can use test account for testing and development
28
+
29
+ Create a client object with the following code:
30
+
31
+ ```ruby
32
+ client = Daxtra::Client.new(account: "test")
33
+ ```
34
+ You can pass in a server name as a second key argument if you have one (`server: "your-server"`).
35
+
36
+
37
+ When that's set, your client object has two methods:
38
+
39
+ `#post_profile_full`
40
+ `client.post_profile_full(file)` will return parsed resume from daXtra.
41
+
42
+ `#post_convert_2_html`
43
+ `client.post_convert_2_html(file)` will return resume as an html (xml, to be honest) converted by daXtra.
44
+
45
+ The `file` argument in the examples above is your resume as a string read from the actual file. E.g., if you're using Paperclip gem, this looks like the following:
46
+ `Paperclip.io_adapters.for(attachment).read`
47
+
48
+ ## Development
49
+
50
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
51
+
52
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
53
+
54
+ ## Contributing
55
+
56
+ Bug reports and pull requests are welcome on GitHub project's [page](https://github.com/andrewr224/daxtra).. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
57
+
58
+ ## License
59
+
60
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
61
+
62
+ ## Code of Conduct
63
+
64
+ Everyone interacting in the Daxtra project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/daxtra/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "daxtra"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("lib", __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "daxtra/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "daxtra"
9
+ spec.version = Daxtra::VERSION
10
+ spec.authors = ["andrew_r"]
11
+ spec.email = ["andrew.r224@gmail.com"]
12
+
13
+ spec.summary = "Write a short summary, because RubyGems requires one."
14
+ spec.description = "Write a longer description or delete this line."
15
+ spec.homepage = "https://github.com/andrewr224/daxtra"
16
+ spec.license = "MIT"
17
+
18
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
19
+ `git ls-files -z`
20
+ .split("\x0")
21
+ .reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ end
23
+
24
+ spec.bindir = "exe"
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ["lib"]
27
+
28
+ spec.required_ruby_version = ">= 2.5.0"
29
+
30
+ spec.add_dependency "faraday", "~> 0.15.2"
31
+
32
+ spec.add_development_dependency "bundler", "~> 1.17"
33
+ spec.add_development_dependency "pry", "~> 0.12"
34
+ spec.add_development_dependency "rack-test", "~> 1.1"
35
+ spec.add_development_dependency "rake", "~> 10.0"
36
+ spec.add_development_dependency "rspec", "~> 3.0"
37
+ spec.add_development_dependency "rubocop", "~> 0.65"
38
+ spec.add_development_dependency "rubocop-rspec", "~> 1.32"
39
+ spec.add_development_dependency "vcr", "~> 4.0"
40
+ spec.add_development_dependency "webmock", "~> 3.5"
41
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "daxtra/version"
4
+ require "daxtra/client"
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "faraday"
4
+ require "json"
5
+
6
+ module Daxtra
7
+ class Client
8
+ PATH = {
9
+ http_prefix: "http://",
10
+ daxtra_server: "cvxdemo.daxtra.com",
11
+ api_version: "/cvx/rest/api/v1",
12
+ profile_full_path: "/profile/full/json",
13
+ convert_2_html_path: "/convert2html"
14
+ }.freeze
15
+
16
+ def initialize(account:, **options)
17
+ @account = account
18
+ @server = options.delete(:server)
19
+ end
20
+
21
+ def post_profile_full(file)
22
+ Faraday.post do |req|
23
+ req.url(profile_full_url)
24
+ req.body = body.merge(file: file)
25
+ end
26
+ end
27
+
28
+ def post_convert_2_html(file)
29
+ Faraday.post do |req|
30
+ req.url(convert_2_html_url)
31
+ req.body = body.merge(file: file)
32
+ end
33
+ end
34
+
35
+ private
36
+
37
+ attr_reader :account, :server
38
+
39
+ def path
40
+ @path ||= server ? PATH.merge(daxtra_server: server) : PATH
41
+ end
42
+
43
+ def profile_full_url
44
+ PATH.values_at(
45
+ :http_prefix, :daxtra_server, :api_version, :profile_full_path
46
+ ).join
47
+ end
48
+
49
+ def convert_2_html_url
50
+ PATH.values_at(
51
+ :http_prefix, :daxtra_server, :api_version, :convert_2_html_path
52
+ ).join
53
+ end
54
+
55
+ def body
56
+ { account: account }
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Daxtra
4
+ VERSION = "0.1.0"
5
+ end
metadata ADDED
@@ -0,0 +1,200 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: daxtra
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - andrew_r
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-03-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.15.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.15.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.17'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.17'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.12'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.12'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rack-test
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.1'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.65'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.65'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.32'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.32'
125
+ - !ruby/object:Gem::Dependency
126
+ name: vcr
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '4.0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '4.0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: webmock
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '3.5'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '3.5'
153
+ description: Write a longer description or delete this line.
154
+ email:
155
+ - andrew.r224@gmail.com
156
+ executables: []
157
+ extensions: []
158
+ extra_rdoc_files: []
159
+ files:
160
+ - ".gitignore"
161
+ - ".rspec"
162
+ - ".rubocop.yml"
163
+ - ".travis.yml"
164
+ - CODE_OF_CONDUCT.md
165
+ - Gemfile
166
+ - Gemfile.lock
167
+ - LICENSE.txt
168
+ - README.md
169
+ - Rakefile
170
+ - bin/console
171
+ - bin/setup
172
+ - daxtra.gemspec
173
+ - lib/daxtra.rb
174
+ - lib/daxtra/client.rb
175
+ - lib/daxtra/version.rb
176
+ homepage: https://github.com/andrewr224/daxtra
177
+ licenses:
178
+ - MIT
179
+ metadata: {}
180
+ post_install_message:
181
+ rdoc_options: []
182
+ require_paths:
183
+ - lib
184
+ required_ruby_version: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ version: 2.5.0
189
+ required_rubygems_version: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - ">="
192
+ - !ruby/object:Gem::Version
193
+ version: '0'
194
+ requirements: []
195
+ rubyforge_project:
196
+ rubygems_version: 2.7.3
197
+ signing_key:
198
+ specification_version: 4
199
+ summary: Write a short summary, because RubyGems requires one.
200
+ test_files: []