prizepicks 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5d51524708c35ebc1f268da73f0e1e775ad73fe1cf934298b213d00780caa955
4
+ data.tar.gz: 60d1d5ea95ba5b19c852d0d072a8c72a52206c3298a914c611ffe255a3db19be
5
+ SHA512:
6
+ metadata.gz: e56a6da76f6becb43d8bbee75775b1bc7c1f7386976af7eb084630f745167a6d6a10ea9fbdc7975606d2c713339a185acc31f3fc6483c751f7bf16c53fdb5c9e
7
+ data.tar.gz: 230cb86cef2c1b04e83c02dcd64b5fe36202d3d3da0290b99bd39e19042618c997038d62ec3c13e290aa597314fa654324c5b45bd1d76445d06174cdedc73536
data/.rubocop.yml ADDED
@@ -0,0 +1,36 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-minitest
4
+
5
+ AllCops:
6
+ DisplayCopNames: true
7
+ Exclude:
8
+ - bin/**/*
9
+ - vendor/**/*
10
+ Layout/EmptyLineAfterMagicComment:
11
+ Enabled: false
12
+ Layout/FirstArrayElementIndentation:
13
+ EnforcedStyle: consistent
14
+ Layout/FirstArrayElementLineBreak:
15
+ Enabled: true
16
+ Layout/FirstHashElementIndentation:
17
+ EnforcedStyle: consistent
18
+ Layout/FirstHashElementLineBreak:
19
+ Enabled: true
20
+ Layout/HashAlignment:
21
+ EnforcedColonStyle: key
22
+ EnforcedRocketStyle: key
23
+ # Layout/IndentationStyle:
24
+ # EnforcedStyle: tabs
25
+ Metrics/BlockLength:
26
+ Max: 250
27
+ Metrics/ClassLength:
28
+ Max: 250
29
+ Metrics/LineLength:
30
+ Max: 120
31
+ Style/Documentation:
32
+ Enabled: false
33
+ Style/ModuleFunction:
34
+ Enabled: false
35
+ Style/TrailingCommaInHashLiteral:
36
+ EnforcedStyleForMultiline: comma
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in prizepicks.gemspec
6
+ gemspec
7
+
8
+ gem 'faraday'
9
+ gem 'faraday-cookie_jar'
10
+ gem 'minitest', '~> 5.0'
11
+ gem 'rake', '~> 13.0'
data/Gemfile.lock ADDED
@@ -0,0 +1,74 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ prizepicks (0.1.0)
5
+ faraday
6
+ faraday-cookie_jar
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ast (2.4.2)
12
+ domain_name (0.5.20190701)
13
+ unf (>= 0.0.5, < 1.0.0)
14
+ faraday (2.7.4)
15
+ faraday-net_http (>= 2.0, < 3.1)
16
+ ruby2_keywords (>= 0.0.4)
17
+ faraday-cookie_jar (0.0.7)
18
+ faraday (>= 0.8.0)
19
+ http-cookie (~> 1.0.0)
20
+ faraday-net_http (3.0.2)
21
+ http-cookie (1.0.5)
22
+ domain_name (~> 0.5)
23
+ json (2.6.2)
24
+ minitest (5.17.0)
25
+ parallel (1.22.1)
26
+ parser (3.1.2.1)
27
+ ast (~> 2.4.1)
28
+ rainbow (3.1.1)
29
+ rake (13.0.6)
30
+ regexp_parser (2.6.1)
31
+ rexml (3.2.5)
32
+ rubocop (1.36.0)
33
+ json (~> 2.3)
34
+ parallel (~> 1.10)
35
+ parser (>= 3.1.2.1)
36
+ rainbow (>= 2.2.2, < 4.0)
37
+ regexp_parser (>= 1.8, < 3.0)
38
+ rexml (>= 3.2.5, < 4.0)
39
+ rubocop-ast (>= 1.20.1, < 2.0)
40
+ ruby-progressbar (~> 1.7)
41
+ unicode-display_width (>= 1.4.0, < 3.0)
42
+ rubocop-ast (1.21.0)
43
+ parser (>= 3.1.1.0)
44
+ rubocop-minitest (0.21.1)
45
+ rubocop (>= 0.90, < 2.0)
46
+ rubocop-performance (1.14.3)
47
+ rubocop (>= 1.7.0, < 2.0)
48
+ rubocop-ast (>= 0.4.0)
49
+ ruby-progressbar (1.11.0)
50
+ ruby2_keywords (0.0.5)
51
+ unf (0.1.4)
52
+ unf_ext
53
+ unf_ext (0.0.8.2)
54
+ unicode-display_width (2.2.0)
55
+ webrick (1.7.0)
56
+ yard (0.9.28)
57
+ webrick (~> 1.7.0)
58
+
59
+ PLATFORMS
60
+ x86_64-linux
61
+
62
+ DEPENDENCIES
63
+ faraday
64
+ faraday-cookie_jar
65
+ minitest (~> 5.0)
66
+ prizepicks!
67
+ rake (~> 13.0)
68
+ rubocop
69
+ rubocop-minitest
70
+ rubocop-performance
71
+ yard
72
+
73
+ BUNDLED WITH
74
+ 2.4.5
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Prizepicks
2
+
3
+ TODO: Delete this and the text below, and describe your gem
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/prizepicks`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ ## Installation
8
+
9
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
+
11
+ Install the gem and add to the application's Gemfile by executing:
12
+
13
+ $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
14
+
15
+ If bundler is not being used to manage dependencies, install the gem by executing:
16
+
17
+ $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Development
24
+
25
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
26
+
27
+ 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/prizepicks.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << 'test'
8
+ t.libs << 'lib'
9
+ t.test_files = FileList['test/**/test_*.rb']
10
+ end
11
+
12
+ task default: :test
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+ module PrizePicks
3
+ module Api
4
+ module Endpoints
5
+ module Entries
6
+ def entries(options = {})
7
+ request(:get, 'v1/entries', options)
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+ module PrizePicks
3
+ module Api
4
+ module Endpoints
5
+ module SignIn
6
+ def sign_in
7
+ request(:post, '/users/sign_in', {
8
+ user: {
9
+ email: @email,
10
+ password: @password,
11
+ },
12
+ })
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'endpoints/entries'
4
+ require_relative 'endpoints/sign_in'
5
+
6
+ module PrizePicks
7
+ module Api
8
+ module Endpoints
9
+ include Entries
10
+ include SignIn
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+ module PrizePicks
3
+ class Client
4
+ include Faraday::Connection
5
+ include Faraday::Request
6
+ include Api::Endpoints
7
+
8
+ attr_accessor(*Config::ATTRIBUTES)
9
+
10
+ def initialize(options = {})
11
+ PrizePicks::Config::ATTRIBUTES.each do |key|
12
+ send("#{key}=", options.fetch(key, PrizePicks.config.send(key)))
13
+ end
14
+
15
+ raise ArgumentError, 'Missing :email' unless email
16
+ raise ArgumentError, 'Missing :password' unless password
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+ module PrizePicks
3
+ module Config
4
+ extend self
5
+
6
+ ATTRIBUTES = %i[
7
+ email
8
+ endpoint
9
+ password
10
+ ].freeze
11
+
12
+ attr_accessor(*Config::ATTRIBUTES)
13
+
14
+ def reset
15
+ self.endpoint = 'https://api.prizepicks.com/'
16
+ end
17
+ end
18
+
19
+ class << self
20
+ def configure
21
+ block_given? ? yield(Config) : Config
22
+ end
23
+
24
+ def config
25
+ Config
26
+ end
27
+ end
28
+ end
29
+
30
+ PrizePicks::Config.reset
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+ module PrizePicks
3
+ module Faraday
4
+ module Connection
5
+ private
6
+
7
+ def connection
8
+ @connection ||= ::Faraday.new(endpoint) do |faraday|
9
+ faraday.request :json
10
+ faraday.response :json
11
+ faraday.use :cookie_jar
12
+ faraday.response :raise_error
13
+ faraday.adapter ::Faraday.default_adapter
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+ module PrizePicks
3
+ module Faraday
4
+ module Request
5
+ def get(path, options = {})
6
+ request(:get, path, options)
7
+ end
8
+
9
+ def post(path, options = {})
10
+ request(:post, path, options)
11
+ end
12
+
13
+ private
14
+
15
+ def request(method, path, options)
16
+ response = connection.send(method) do |request|
17
+ case method
18
+ when :get
19
+ request.url(path, options)
20
+ when :post
21
+ request.path = path
22
+ request.body = options unless options.empty?
23
+ end
24
+ end
25
+
26
+ response.body
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PrizePicks
4
+ VERSION = '0.1.0'
5
+ end
data/lib/prizepicks.rb ADDED
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'prizepicks/version'
4
+ require 'prizepicks/config'
5
+
6
+ require 'faraday'
7
+ require 'faraday-cookie_jar'
8
+
9
+ require_relative 'prizepicks/faraday/connection'
10
+ require_relative 'prizepicks/faraday/request'
11
+ require_relative 'prizepicks/api/endpoints'
12
+ require_relative 'prizepicks/client'
13
+
14
+ # module Prizepicks
15
+ # class Error < StandardError; end
16
+ # # Your code goes here...
17
+ # end
@@ -0,0 +1,4 @@
1
+ module Prizepicks
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: prizepicks
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Troy Underwood
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-02-17 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'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday-cookie_jar
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop-minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-performance
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: yard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: PrizePick client to fetch data from the PrizePicks API.
98
+ email:
99
+ - troyizzle@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".rubocop.yml"
105
+ - Gemfile
106
+ - Gemfile.lock
107
+ - README.md
108
+ - Rakefile
109
+ - lib/prizepicks.rb
110
+ - lib/prizepicks/api/endpoints.rb
111
+ - lib/prizepicks/api/endpoints/entries.rb
112
+ - lib/prizepicks/api/endpoints/sign_in.rb
113
+ - lib/prizepicks/client.rb
114
+ - lib/prizepicks/config.rb
115
+ - lib/prizepicks/faraday/connection.rb
116
+ - lib/prizepicks/faraday/request.rb
117
+ - lib/prizepicks/version.rb
118
+ - sig/prizepicks.rbs
119
+ homepage: https://github.com/troyizzle/prizepicks
120
+ licenses: []
121
+ metadata:
122
+ homepage_uri: https://github.com/troyizzle/prizepicks
123
+ source_code_uri: https://github.com/troyizzle/prizepicks
124
+ post_install_message:
125
+ rdoc_options: []
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: 3.0.0
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ requirements: []
139
+ rubygems_version: 3.4.5
140
+ signing_key:
141
+ specification_version: 4
142
+ summary: PrizePicks client
143
+ test_files: []