feathr 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +5 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +4 -0
  7. data/Gemfile.lock +41 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +98 -0
  10. data/Rakefile +6 -0
  11. data/bin/console +13 -0
  12. data/bin/setup +8 -0
  13. data/config/solano.yml +6 -0
  14. data/feathr.gemspec +30 -0
  15. data/lib/feathr.rb +56 -0
  16. data/lib/feathr/api/account.rb +9 -0
  17. data/lib/feathr/api/accounts.rb +11 -0
  18. data/lib/feathr/api/api_token_auth.rb +14 -0
  19. data/lib/feathr/api/api_token_refresh.rb +14 -0
  20. data/lib/feathr/api/api_token_verify.rb +14 -0
  21. data/lib/feathr/api/cashout.rb +9 -0
  22. data/lib/feathr/api/cashouts.rb +20 -0
  23. data/lib/feathr/api/contractor.rb +9 -0
  24. data/lib/feathr/api/contractors.rb +11 -0
  25. data/lib/feathr/api/feathr_endpoint.rb +102 -0
  26. data/lib/feathr/api/feathr_error.rb +15 -0
  27. data/lib/feathr/api/feathr_object.rb +37 -0
  28. data/lib/feathr/api/featured_platforms.rb +11 -0
  29. data/lib/feathr/api/healthz.rb +13 -0
  30. data/lib/feathr/api/income.rb +9 -0
  31. data/lib/feathr/api/income_request.rb +9 -0
  32. data/lib/feathr/api/income_requests.rb +14 -0
  33. data/lib/feathr/api/incomes.rb +11 -0
  34. data/lib/feathr/api/invoice.rb +9 -0
  35. data/lib/feathr/api/invoices.rb +11 -0
  36. data/lib/feathr/api/manager.rb +13 -0
  37. data/lib/feathr/api/managers.rb +12 -0
  38. data/lib/feathr/api/membership.rb +27 -0
  39. data/lib/feathr/api/membership_request.rb +9 -0
  40. data/lib/feathr/api/membership_requests.rb +14 -0
  41. data/lib/feathr/api/memberships.rb +11 -0
  42. data/lib/feathr/api/paypal_service.rb +0 -0
  43. data/lib/feathr/api/platform.rb +13 -0
  44. data/lib/feathr/api/platforms.rb +11 -0
  45. data/lib/feathr/api/public_platforms.rb +11 -0
  46. data/lib/feathr/api/rebate.rb +9 -0
  47. data/lib/feathr/api/rebates.rb +11 -0
  48. data/lib/feathr/api/receiveable.rb +9 -0
  49. data/lib/feathr/api/receiveables.rb +11 -0
  50. data/lib/feathr/api/reset_password.rb +14 -0
  51. data/lib/feathr/api/user.rb +11 -0
  52. data/lib/feathr/api/users.rb +19 -0
  53. data/lib/feathr/client.rb +146 -0
  54. data/lib/feathr/config.rb +39 -0
  55. data/lib/feathr/version.rb +3 -0
  56. metadata +168 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6ae650f7803f02e1c78fdfeb157fb0172b63a7f9
4
+ data.tar.gz: e93b13277216ac2c8df100d10227f928fccfecf2
5
+ SHA512:
6
+ metadata.gz: a0fd0e8d2936f63d4a08175e5f8150a6edfe30ac2c3bafe1bdcb46e1b487bcdd89ee6add4dbca1547ef776ff1a821ff2e564f36c4b12429add1b59153f9d4693
7
+ data.tar.gz: 6df71e6e30ee147aecb9385322953019ef8e575d63aca1a93f3b3ca44063aeb85d71d73cd1bdbdc514a42a8f792475ba2b19e13e972973727f57bd69500cbe7e
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.3
5
+ before_install: gem install bundler -v 1.13.6
@@ -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 brad@hired.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,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in feathr.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,41 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ feathr (0.1.0)
5
+ httparty
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ awesome_print (1.7.0)
11
+ diff-lcs (1.2.5)
12
+ httparty (0.14.0)
13
+ multi_xml (>= 0.5.2)
14
+ multi_xml (0.6.0)
15
+ rake (10.5.0)
16
+ rspec (3.5.0)
17
+ rspec-core (~> 3.5.0)
18
+ rspec-expectations (~> 3.5.0)
19
+ rspec-mocks (~> 3.5.0)
20
+ rspec-core (3.5.4)
21
+ rspec-support (~> 3.5.0)
22
+ rspec-expectations (3.5.0)
23
+ diff-lcs (>= 1.2.0, < 2.0)
24
+ rspec-support (~> 3.5.0)
25
+ rspec-mocks (3.5.0)
26
+ diff-lcs (>= 1.2.0, < 2.0)
27
+ rspec-support (~> 3.5.0)
28
+ rspec-support (3.5.0)
29
+
30
+ PLATFORMS
31
+ ruby
32
+
33
+ DEPENDENCIES
34
+ awesome_print
35
+ bundler
36
+ feathr!
37
+ rake (~> 10.0)
38
+ rspec (~> 3.0)
39
+
40
+ BUNDLED WITH
41
+ 1.13.6
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Brad Herman
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,98 @@
1
+ ![solano](https://ci.solanolabs.com:443/Hired/feathr/badges/branches/master?badge_token=7f681a0a4b3a10ec622b501e8de35ec60837531d)
2
+
3
+ # Feathr
4
+
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/feathr`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ TODO: Delete this and the text above, and describe your gem
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'feathr'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install feathr
24
+
25
+ ## Usage
26
+
27
+ ```
28
+ Feathr.configure do |config|
29
+ config.api_email = 'email@email.com'
30
+ config.api_password = 'password'
31
+ end
32
+
33
+ $client = Feathr::Client.new
34
+
35
+ manager = $client.managers.find(id)
36
+
37
+ platforms = manager.platforms.all
38
+
39
+ platform = manager.platforms.find(id)
40
+
41
+ platform.contractors.all
42
+
43
+ contractor = platform.contractors.create({ email: 'email@email.com' })
44
+
45
+ platform.memberships.all
46
+
47
+ platform.memberships.create({ user: user_url })
48
+
49
+ etc
50
+ ```
51
+
52
+ TODO:
53
+
54
+ NOT PRODUCTION READY outside
55
+
56
+ - csv_upload - POST - platforms/{ pk }/csv-upload/user/
57
+ - csv_upload - POST - platforms/{ pk }/csv-upload/income/
58
+ - paypal_service batch - POST /paypal_service/callback/batch/
59
+ - paypal_service income - POST /paypal_service/callback/payout_item/
60
+ - platform membership request accept - POST /platforms/{ pk }/membership_requests/accept/
61
+ - platform membership request accept - GET/POST /platforms/{ pk }/membership_requests/accept/
62
+ - platform membership request deny - GET/POST /platforms/{ pk }/membership_requests/deny/
63
+ - platform income request deny - GET/POST /platforms/{ pk }/income_requests/cancel/
64
+ - user "me" update - PUT/PATCH /users/me
65
+ - platform membership requests - GET /users/{ pk }/platform_membership_requests/
66
+ - platform membership requests create - POST /users/{ pk }/platform_membership_requests/
67
+ - platform membership requests find - GET /users/{ pk }/platform_membership_requests/{ pk }/
68
+ - platform membership requests cancel - POST/GET /users/{ pk }/platform_membership_requests/{ pk }/cancel/
69
+ - administered platforms - POST /users/{ pk }/administered_platforms/
70
+ - tax savings - GET /users/{ pk }/tax_savings/
71
+ - tax savings update - UPDATE /users/{ pk }/tax_savings/
72
+ - cashout available - GET /users/{ pk }/cashout_available/
73
+ - cashout available - POST /users/{ pk }/cashout_available/
74
+ - user integrations
75
+
76
+ - Refactor Update & destroy to only be available on object itself ??
77
+ - Scope nested routes to certain actions ??
78
+ - add code coverage and cc github integrations
79
+ - fix issue with nested routes and find actions (nested find vs non-nested find)
80
+ - use urls instead of ids ??
81
+ - missing a few tests
82
+ - remove unnecessary intermediate queries
83
+
84
+ ## Development
85
+
86
+ 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.
87
+
88
+ 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).
89
+
90
+ ## Contributing
91
+
92
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bradherman/feathr. 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.
93
+
94
+
95
+ ## License
96
+
97
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
98
+
data/Rakefile ADDED
@@ -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
data/bin/console ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "feathr"
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
+ require "irb"
10
+ require "awesome_print"
11
+
12
+ AwesomePrint.irb!
13
+ IRB.start
data/bin/setup ADDED
@@ -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
data/config/solano.yml ADDED
@@ -0,0 +1,6 @@
1
+ # config/solano.yml
2
+ ---
3
+ ruby_version: ruby-2.3.3
4
+ bundler_version: 1.13.6
5
+ test_pattern:
6
+ - spec/**/*_spec.rb
data/feathr.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'feathr/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "feathr"
8
+ spec.version = Feathr::VERSION
9
+ spec.authors = ["Brad Herman"]
10
+ spec.email = ["brad@hired.com"]
11
+
12
+ spec.summary = %q{ Rails API for interacting with Qwil API.}
13
+ spec.description = %q{ Rails API for interacting with Qwil API.}
14
+ spec.homepage = "https://github.com/hired/feathr"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_runtime_dependency 'httparty'
25
+
26
+ spec.add_development_dependency "bundler"
27
+ spec.add_development_dependency "awesome_print"
28
+ spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rspec", "~> 3.0"
30
+ end
data/lib/feathr.rb ADDED
@@ -0,0 +1,56 @@
1
+ require "feathr/version"
2
+ require "feathr/config"
3
+ require "feathr/client"
4
+
5
+ require 'feathr/api/feathr_endpoint'
6
+ require 'feathr/api/feathr_object'
7
+ require 'feathr/api/feathr_error'
8
+
9
+ require 'feathr/api/account'
10
+ require 'feathr/api/cashout'
11
+ require 'feathr/api/contractor'
12
+ require 'feathr/api/income'
13
+ require 'feathr/api/income_request'
14
+ require 'feathr/api/invoice'
15
+ require 'feathr/api/manager'
16
+ require 'feathr/api/membership'
17
+ require 'feathr/api/membership_request'
18
+ require 'feathr/api/platform'
19
+ require 'feathr/api/rebate'
20
+ require 'feathr/api/receiveable'
21
+ require 'feathr/api/user'
22
+
23
+ require 'feathr/api/api_token_auth'
24
+ require 'feathr/api/api_token_refresh'
25
+ require 'feathr/api/api_token_verify'
26
+ require 'feathr/api/accounts'
27
+ require 'feathr/api/cashouts'
28
+ require 'feathr/api/contractors'
29
+ require 'feathr/api/featured_platforms'
30
+ require 'feathr/api/healthz'
31
+ require 'feathr/api/incomes'
32
+ require 'feathr/api/income_requests'
33
+ require 'feathr/api/invoices'
34
+ require 'feathr/api/managers'
35
+ require 'feathr/api/memberships'
36
+ require 'feathr/api/membership_requests'
37
+ require 'feathr/api/platforms'
38
+ require 'feathr/api/public_platforms'
39
+ require 'feathr/api/rebates'
40
+ require 'feathr/api/receiveables'
41
+ require 'feathr/api/reset_password'
42
+ require 'feathr/api/users'
43
+
44
+ module Feathr
45
+ class << self
46
+
47
+ def configure
48
+ if block_given?
49
+ yield(Feathr::Config.default)
50
+ else
51
+ Feathr::Config.default
52
+ end
53
+ end
54
+
55
+ end
56
+ end
@@ -0,0 +1,9 @@
1
+ module Feathr
2
+ module Api
3
+
4
+ class Account < Feathr::Api::FeathrObject
5
+ api_path 'accounts'
6
+ end
7
+
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ module Feathr
2
+ module Api
3
+
4
+ class Accounts < Feathr::Api::FeathrEndpoint
5
+ api_path 'accounts'
6
+ feathr_object Feathr::Api::Account
7
+ feathr_endpoints :update, :find, :destroy, :all, :create
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ module Feathr
2
+ module Api
3
+
4
+ class ApiTokenAuth < Feathr::Api::FeathrEndpoint
5
+ api_path 'api-token-auth'
6
+
7
+ def authenticate(email:, password:)
8
+ query = { email: email, password: password }
9
+ client.request(method: :post, path: api_path, query: query)
10
+ end
11
+ end
12
+
13
+ end
14
+ end