pocket-ruby-andyw8 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 184559f436d9a7270366507934bbf439a9f99a9eb7b4f567def2c557f0e7200f
4
- data.tar.gz: a46cd3667e1fcf6626a8abb0aca9cc4739a6ad1a5866c5639cf8bed2e6f45630
3
+ metadata.gz: 40c39385a1a1c1eb0ce3ecc48f84d4983607043e25654aeac1b871ee3467b954
4
+ data.tar.gz: e9b1681b23936e9ae5ac6f18952a6e43a82765912685d98ef72c3999a60f05b3
5
5
  SHA512:
6
- metadata.gz: ee26f47f82484ab5f1ccccb91fef3ac282b0d515d2d8da0208b9cbc7b1f337807b02ab669c64a6610c385dffd9d7cb0681412b0396ec3cbf4e28732988825c9b
7
- data.tar.gz: 6310e11534eb9ecf4df690ec093b9a0c7fb4a8f88874b27661b3ff1b4fe45e1df392e5b76ff7d234a0efb8e58afc5450164e5dab508a5b3aee06a91ce76a645b
6
+ metadata.gz: f382487e138e17d21d59cb098169e7a500a84e0189e5fba3615bfc50f01dfa25dc4ea521139d45c1dce125bb8ac44437d23ffb852edea1479c8badaa7573bc96
7
+ data.tar.gz: b7f12023a1f33377c5a47798fcb9972b99561c7a50543d6df73cfc8db729c3b75625d4d1a5f94dae2f3dc6a916334492a40dba693fc73bb5b7146f27b7b7ed27
@@ -0,0 +1,18 @@
1
+ name: changelog-chcker
2
+ on:
3
+ pull_request:
4
+ types: [assigned, opened, synchronize, reopened, labeled, unlabeled]
5
+ branches:
6
+ - master
7
+ jobs:
8
+ build:
9
+ name: Check Actions
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v1
13
+ - name: Changelog check
14
+ uses: Zomzog/changelog-checker@v1.2.0
15
+ with:
16
+ fileName: CHANGELOG.md
17
+ env:
18
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,18 @@
1
+ name: Ruby
2
+
3
+ on: [push,pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: 2.6.6
14
+ - name: Run the default task
15
+ run: |
16
+ gem install bundler -v 2.2.8
17
+ bundle install
18
+ bundle exec rake
data/.gitignore CHANGED
@@ -11,7 +11,6 @@ spec/reports
11
11
  test/tmp
12
12
  test/version_tmp
13
13
  tmp
14
- Gemfile.lock
15
14
  # YARD artifacts
16
15
  .yardoc
17
16
  _yardoc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
- # Unreleased
1
+ ## [Unreleased]
2
2
 
3
- # v0.0.7 (2021-03-08)
3
+ ## [0.0.8] - 2021-03-28
4
4
 
5
- * Relax Faraday version contraint
5
+ - Remove unused Hashie dependency ([#3](https://github.com/andyw8/pocket-ruby/pull/3))
6
+ - Prevent some Ruby warnings ([#1](https://github.com/andyw8/pocket-ruby/pull/1))
7
+
8
+ ## [0.0.7] - 2021-03-28
9
+
10
+ - Relax Faraday version constraint
data/Gemfile.lock ADDED
@@ -0,0 +1,78 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ pocket-ruby-andyw8 (0.0.7)
5
+ faraday (>= 0.7)
6
+ faraday_middleware
7
+ hashie (>= 0.4.0)
8
+ multi_json (~> 1.0, >= 1.0.3)
9
+
10
+ GEM
11
+ remote: http://rubygems.org/
12
+ specs:
13
+ ast (2.4.2)
14
+ faraday (1.3.0)
15
+ faraday-net_http (~> 1.0)
16
+ multipart-post (>= 1.2, < 3)
17
+ ruby2_keywords
18
+ faraday-net_http (1.0.1)
19
+ faraday_middleware (1.0.0)
20
+ faraday (~> 1.0)
21
+ hashie (4.1.0)
22
+ multi_json (1.15.0)
23
+ multi_xml (0.6.0)
24
+ multipart-post (2.1.1)
25
+ parallel (1.20.1)
26
+ parser (3.0.0.0)
27
+ ast (~> 2.4.1)
28
+ power_assert (1.1.3)
29
+ rack (1.6.13)
30
+ rack-protection (1.5.5)
31
+ rack
32
+ rainbow (3.0.0)
33
+ rake (13.0.3)
34
+ regexp_parser (2.1.1)
35
+ rexml (3.2.4)
36
+ rubocop (1.11.0)
37
+ parallel (~> 1.10)
38
+ parser (>= 3.0.0.0)
39
+ rainbow (>= 2.2.2, < 4.0)
40
+ regexp_parser (>= 1.8, < 3.0)
41
+ rexml
42
+ rubocop-ast (>= 1.2.0, < 2.0)
43
+ ruby-progressbar (~> 1.7)
44
+ unicode-display_width (>= 1.4.0, < 3.0)
45
+ rubocop-ast (1.4.1)
46
+ parser (>= 2.7.1.5)
47
+ rubocop-performance (1.10.1)
48
+ rubocop (>= 0.90.0, < 2.0)
49
+ rubocop-ast (>= 0.4.0)
50
+ ruby-progressbar (1.11.0)
51
+ ruby2_keywords (0.0.4)
52
+ sinatra (1.3.6)
53
+ rack (~> 1.4)
54
+ rack-protection (~> 1.3)
55
+ tilt (~> 1.3, >= 1.3.3)
56
+ standard (1.0.4)
57
+ rubocop (= 1.11.0)
58
+ rubocop-performance (= 1.10.1)
59
+ standardrb (1.0.0)
60
+ standard
61
+ test-unit (3.2.9)
62
+ power_assert
63
+ tilt (1.4.1)
64
+ unicode-display_width (2.0.0)
65
+
66
+ PLATFORMS
67
+ x86_64-darwin-19
68
+
69
+ DEPENDENCIES
70
+ multi_xml
71
+ pocket-ruby-andyw8!
72
+ rake
73
+ sinatra (~> 1.3.3)
74
+ standardrb
75
+ test-unit
76
+
77
+ BUNDLED WITH
78
+ 2.2.8
data/README.md CHANGED
@@ -1,31 +1,21 @@
1
1
  pocket-ruby
2
2
  ===========
3
3
 
4
- [![Code Climate](https://codeclimate.com/github/turadg/pocket-ruby.png)](https://codeclimate.com/github/turadg/pocket-ruby) [![Gem Version](https://badge.fury.io/rb/pocket-ruby.png)](http://badge.fury.io/rb/pocket-ruby)
4
+ Ruby API for v3 of the [Pocket API](http://getpocket.com/developer/docs/overview) (formerly Read It Later)
5
5
 
6
- Ruby API for v3 of the [Pocket API](http://getpocket.com/developer/docs/overview) (formerly Read It Later)
6
+ This is a fork of [turadg/pocket-ruby](https://github.com/turadg/pocket-ruby) since it hadn't been updated since 2015.
7
7
 
8
8
  # Usage
9
9
 
10
- Just clone the repo here and refer to the demo-server.rb file for examples on how to interact with the Pocket API.
10
+ Just clone the repo here and refer to the demo-server.rb file for examples on how to interact with the Pocket API.
11
11
 
12
12
  ```sh
13
13
  git clone
14
- cd pocket-ruby
14
+ cd pocket-ruby-andyw8
15
15
  bundle install
16
16
  ruby demo-server.rb
17
17
  ```
18
18
 
19
- Pocket-Ruby can be installed via the gem, ```gem install pocket-ruby```
19
+ Pocket-Ruby can be installed via the gem, ```gem install pocket-ruby-andyw8```
20
20
 
21
- Or via bundler, ```gem 'pocket-ruby'```
22
-
23
- # For v0.0.5 and earlier
24
-
25
- Using v0.0.5 and earlier may result in a ```require``` error. To fix this you may either update to a newer version of the gem or uninstall with ```gem uninstall pocket-ruby``` and try again using the method below:
26
-
27
- Install via the gem, ```gem install pocket-ruby -v 0.0.5```
28
-
29
- Or via bundler, ```gem 'pocket-ruby', '0.0.5', :require => 'pocket'```
30
-
31
- Be sure to require the gem in your code with ```require 'pocket'``` not ```require 'pocket-ruby'```
21
+ Or via bundler, ```gem 'pocket-ruby-andyw8', require: 'pocket-ruby'```
data/Rakefile CHANGED
@@ -1,27 +1,31 @@
1
- require 'bundler'
1
+ require "bundler"
2
2
  Bundler::GemHelper.install_tasks
3
3
 
4
- require 'rspec/core/rake_task'
5
- RSpec::Core::RakeTask.new(:spec)
4
+ require "standard/rake"
6
5
 
7
- task :default => :spec
6
+ require "rake/testtask"
7
+ Rake::TestTask.new(:test) do |t|
8
+ t.libs << "test"
9
+ t.libs << "lib"
10
+ t.test_files = FileList["test/**/*_test.rb"]
11
+ end
12
+
13
+ task default: [:test, :standard]
8
14
 
9
15
  namespace :doc do
10
- begin
11
- require 'yard'
12
- rescue LoadError
13
- # ignore
14
- else
15
- YARD::Rake::YardocTask.new do |task|
16
- task.files = ['HISTORY.mkd', 'LICENSE.mkd', 'lib/**/*.rb']
17
- task.options = [
18
- '--protected',
19
- '--output-dir', 'doc/yard',
20
- '--tag', 'format:Supported formats',
21
- '--tag', 'authenticated:Requires Authentication',
22
- '--tag', 'rate_limited:Rate Limited',
23
- '--markup', 'markdown',
24
- ]
25
- end
16
+ require "yard"
17
+ rescue LoadError
18
+ # ignore
19
+ else
20
+ YARD::Rake::YardocTask.new do |task|
21
+ task.files = ["HISTORY.mkd", "LICENSE.mkd", "lib/**/*.rb"]
22
+ task.options = [
23
+ "--protected",
24
+ "--output-dir", "doc/yard",
25
+ "--tag", "format:Supported formats",
26
+ "--tag", "authenticated:Requires Authentication",
27
+ "--tag", "rate_limited:Rate Limited",
28
+ "--markup", "markdown"
29
+ ]
26
30
  end
27
31
  end
data/demo-server.rb CHANGED
@@ -1,16 +1,16 @@
1
1
  require "sinatra"
2
2
 
3
- require "./lib/pocket-ruby.rb"
3
+ require "./lib/pocket-ruby"
4
4
 
5
5
  enable :sessions
6
6
 
7
7
  CALLBACK_URL = "http://localhost:4567/oauth/callback"
8
8
 
9
9
  Pocket.configure do |config|
10
- config.consumer_key = '10188-3565cd04d1464e6d0e64b67f'
10
+ config.consumer_key = "10188-3565cd04d1464e6d0e64b67f"
11
11
  end
12
12
 
13
- get '/reset' do
13
+ get "/reset" do
14
14
  puts "GET /reset"
15
15
  session.clear
16
16
  end
@@ -31,8 +31,8 @@ end
31
31
 
32
32
  get "/oauth/connect" do
33
33
  puts "OAUTH CONNECT"
34
- session[:code] = Pocket.get_code(:redirect_uri => CALLBACK_URL)
35
- new_url = Pocket.authorize_url(:code => session[:code], :redirect_uri => CALLBACK_URL)
34
+ session[:code] = Pocket.get_code(redirect_uri: CALLBACK_URL)
35
+ new_url = Pocket.authorize_url(code: session[:code], redirect_uri: CALLBACK_URL)
36
36
  puts "new_url: #{new_url}"
37
37
  puts "session: #{session}"
38
38
  redirect new_url
@@ -42,26 +42,26 @@ get "/oauth/callback" do
42
42
  puts "OAUTH CALLBACK"
43
43
  puts "request.url: #{request.url}"
44
44
  puts "request.body: #{request.body.read}"
45
- result = Pocket.get_result(session[:code], :redirect_uri => CALLBACK_URL)
46
- session[:access_token] = result['access_token']
47
- puts result['access_token']
48
- puts result['username']
45
+ result = Pocket.get_result(session[:code], redirect_uri: CALLBACK_URL)
46
+ session[:access_token] = result["access_token"]
47
+ puts result["access_token"]
48
+ puts result["username"]
49
49
  # Alternative method to get the access token directly
50
- #session[:access_token] = Pocket.get_access_token(session[:code])
50
+ # session[:access_token] = Pocket.get_access_token(session[:code])
51
51
  puts session[:access_token]
52
52
  puts "session: #{session}"
53
53
  redirect "/"
54
54
  end
55
55
 
56
- get '/add' do
57
- client = Pocket.client(:access_token => session[:access_token])
58
- info = client.add :url => 'http://getpocket.com'
56
+ get "/add" do
57
+ client = Pocket.client(access_token: session[:access_token])
58
+ info = client.add url: "http://getpocket.com"
59
59
  "<pre>#{info}</pre>"
60
60
  end
61
61
 
62
62
  get "/retrieve" do
63
- client = Pocket.client(:access_token => session[:access_token])
64
- info = client.retrieve(:detailType => :complete, :count => 1)
63
+ client = Pocket.client(access_token: session[:access_token])
64
+ info = client.retrieve(detailType: :complete, count: 1)
65
65
 
66
66
  # html = "<h1>#{user.username}'s recent photos</h1>"
67
67
  # for media_item in client.user_recent_media
@@ -1,4 +1,4 @@
1
- require 'faraday'
1
+ require "faraday"
2
2
 
3
3
  # @private
4
4
  module FaradayMiddleware
@@ -6,16 +6,16 @@ module FaradayMiddleware
6
6
  class PocketOAuth < Faraday::Middleware
7
7
  def call(env)
8
8
  env[:body] = {} if env[:body].nil?
9
- env[:body] = env[:body].merge(:consumer_key => @consumer_key)
9
+ env[:body] = env[:body].merge(consumer_key: @consumer_key)
10
10
 
11
11
  if @access_token
12
- env[:body] = env[:body].merge(:access_token => @access_token)
12
+ env[:body] = env[:body].merge(access_token: @access_token)
13
13
  end
14
14
 
15
15
  @app.call env
16
16
  end
17
17
 
18
- def initialize(app, consumer_key, access_token=nil)
18
+ def initialize(app, consumer_key, access_token = nil)
19
19
  @app = app
20
20
  @consumer_key = consumer_key
21
21
  @access_token = access_token
@@ -1,5 +1,4 @@
1
1
  module Faraday
2
-
3
2
  # HTTP Status X-Error-Code X-Error
4
3
  # 400 138 Missing consumer key.
5
4
  # 403 152 Invalid consumer key.
@@ -9,24 +8,24 @@ module Faraday
9
8
  # 403 158 User rejected code.
10
9
  # 403 159 Already used code.
11
10
  # 50X 199 Pocket server issue.
12
- #
11
+ #
13
12
  # @see http://getpocket.com/developer/docs/authentication
14
13
  class Response::RaisePocketError < Response::Middleware
15
- ClientErrorStatuses = 400...600
14
+ CLIENT_ERRORS_STATUSES = 400...600
16
15
 
17
16
  def on_complete(env)
18
17
  case env[:status]
19
18
  when 404
20
19
  raise Faraday::Error::ResourceNotFound, response_values(env)
21
20
  when 400...403
22
- raise Pocket::Error, env[:response_headers]['X-Error']
23
- when ClientErrorStatuses
21
+ raise Pocket::Error, env[:response_headers]["X-Error"]
22
+ when CLIENT_ERRORS_STATUSES
24
23
  raise Faraday::Error::ClientError, response_values(env)
25
24
  end
26
25
  end
27
26
 
28
27
  def response_values(env)
29
- {:status => env[:status], :headers => env[:response_headers], :body => env[:body]}
28
+ {status: env[:status], headers: env[:response_headers], body: env[:body]}
30
29
  end
31
30
  end
32
31
  end
data/lib/pocket-ruby.rb CHANGED
@@ -1,7 +1,7 @@
1
- require File.expand_path('../pocket/error', __FILE__)
2
- require File.expand_path('../pocket/configuration', __FILE__)
3
- require File.expand_path('../pocket/api', __FILE__)
4
- require File.expand_path('../pocket/client', __FILE__)
1
+ require File.expand_path("../pocket/error", __FILE__)
2
+ require File.expand_path("../pocket/configuration", __FILE__)
3
+ require File.expand_path("../pocket/api", __FILE__)
4
+ require File.expand_path("../pocket/client", __FILE__)
5
5
 
6
6
  module Pocket
7
7
  extend Configuration
@@ -9,7 +9,7 @@ module Pocket
9
9
  # Alias for Pocket::Client.new
10
10
  #
11
11
  # @return [Pocket::Client]
12
- def self.client(options={})
12
+ def self.client(options = {})
13
13
  Pocket::Client.new(options)
14
14
  end
15
15
 
@@ -19,8 +19,12 @@ module Pocket
19
19
  client.send(method, *args, &block)
20
20
  end
21
21
 
22
+ def self.respond_to_missing?(method, *args, &block)
23
+ return super unless client.respond_to?(method)
24
+ end
25
+
22
26
  # Delegate to Pocket::Client
23
27
  def self.respond_to?(method)
24
- return client.respond_to?(method) || super
28
+ client.respond_to?(method) || super
25
29
  end
26
30
  end
data/lib/pocket/api.rb CHANGED
@@ -1,14 +1,14 @@
1
- require File.expand_path('../connection', __FILE__)
2
- require File.expand_path('../oauth', __FILE__)
1
+ require File.expand_path("../connection", __FILE__)
2
+ require File.expand_path("../oauth", __FILE__)
3
3
 
4
4
  module Pocket
5
5
  # @private
6
6
  class API
7
7
  # @private
8
- attr_accessor *Configuration::VALID_OPTIONS_KEYS
8
+ attr_accessor(*Configuration::VALID_OPTIONS_KEYS)
9
9
 
10
10
  # Creates a new API
11
- def initialize(options={})
11
+ def initialize(options = {})
12
12
  options = Pocket.options.merge(options)
13
13
  Configuration::VALID_OPTIONS_KEYS.each do |key|
14
14
  send("#{key}=", options[key])
data/lib/pocket/client.rb CHANGED
@@ -4,7 +4,7 @@ module Pocket
4
4
  # @note All methods have been separated into modules and follow the same grouping used in {TODO:doc_URL the Pocket API Documentation}.
5
5
  # @see TODO:doc_url
6
6
  class Client < API
7
- Dir[File.expand_path('../client/*.rb', __FILE__)].each{|f| require f}
7
+ Dir[File.expand_path("../client/*.rb", __FILE__)].sort.each { |f| require f }
8
8
 
9
9
  include Pocket::Client::Add
10
10
  include Pocket::Client::Modify
@@ -3,7 +3,7 @@ module Pocket
3
3
  # http://getpocket.com/developer/docs/v3/retrieve
4
4
  module Retrieve
5
5
  # required params: consumer_key, access_token
6
- def retrieve params=[]
6
+ def retrieve params = []
7
7
  response = connection.post("/v3/get", params)
8
8
  response.body
9
9
  end
@@ -1,5 +1,5 @@
1
- require 'faraday'
2
- require File.expand_path('../version', __FILE__)
1
+ require "faraday"
2
+ require File.expand_path("../version", __FILE__)
3
3
 
4
4
  module Pocket
5
5
  # Defines constants and methods related to configuration
@@ -20,7 +20,8 @@ module Pocket
20
20
  #
21
21
  # @note Not all methods support the XML format.
22
22
  VALID_FORMATS = [
23
- :json].freeze
23
+ :json
24
+ ].freeze
24
25
 
25
26
  # The adapter that will be used to connect if none is set
26
27
  #
@@ -39,7 +40,7 @@ module Pocket
39
40
  # The endpoint that will be used to connect if none is set
40
41
  #
41
42
  # @note There is no reason to use any other endpoint at this time
42
- DEFAULT_ENDPOINT = 'https://getpocket.com/v3/'.freeze
43
+ DEFAULT_ENDPOINT = "https://getpocket.com/v3/".freeze
43
44
 
44
45
  # The response format appended to the path and sent in the 'Accept' header if none is set
45
46
  #
@@ -53,7 +54,7 @@ module Pocket
53
54
  DEFAULT_USER_AGENT = "Pocket Ruby Gem #{Pocket::VERSION}".freeze
54
55
 
55
56
  # @private
56
- attr_accessor *VALID_OPTIONS_KEYS
57
+ attr_accessor(*VALID_OPTIONS_KEYS)
57
58
 
58
59
  # When this module is extended, set all configuration options to their default values
59
60
  def self.extended(base)
@@ -74,14 +75,14 @@ module Pocket
74
75
 
75
76
  # Reset all configuration options to defaults
76
77
  def reset
77
- self.adapter = DEFAULT_ADAPTER
78
- self.consumer_key = DEFAULT_CONSUMER_KEY
79
- self.access_token = DEFAULT_ACCESS_TOKEN
80
- self.endpoint = DEFAULT_ENDPOINT
81
- self.redirect_uri = DEFAULT_REDIRECT_URI
82
- self.format = DEFAULT_FORMAT
83
- self.user_agent = DEFAULT_USER_AGENT
84
- self.proxy = DEFAULT_PROXY
78
+ self.adapter = DEFAULT_ADAPTER
79
+ self.consumer_key = DEFAULT_CONSUMER_KEY
80
+ self.access_token = DEFAULT_ACCESS_TOKEN
81
+ self.endpoint = DEFAULT_ENDPOINT
82
+ self.redirect_uri = DEFAULT_REDIRECT_URI
83
+ self.format = DEFAULT_FORMAT
84
+ self.user_agent = DEFAULT_USER_AGENT
85
+ self.proxy = DEFAULT_PROXY
85
86
  end
86
87
  end
87
88
  end
@@ -1,17 +1,17 @@
1
- require 'faraday_middleware'
2
- Dir[File.expand_path('../../faraday/*.rb', __FILE__)].each{|f| require f}
1
+ require "faraday_middleware"
2
+ Dir[File.expand_path("../../faraday/*.rb", __FILE__)].sort.each { |f| require f }
3
3
 
4
4
  module Pocket
5
5
  # @private
6
6
  module Connection
7
7
  private
8
8
 
9
- def connection(raw=false)
9
+ def connection(raw = false)
10
10
  options = {
11
- :headers => {'User-Agent' => user_agent},
12
- :proxy => proxy,
13
- :ssl => {:verify => false},
14
- :url => endpoint,
11
+ headers: {"User-Agent" => user_agent},
12
+ proxy: proxy,
13
+ ssl: {verify: false},
14
+ url: endpoint
15
15
  }
16
16
 
17
17
  Faraday::Connection.new(options) do |conn|
@@ -20,7 +20,7 @@ module Pocket
20
20
 
21
21
  conn.request :json
22
22
 
23
- conn.response :json, :content_type => /\bjson$/
23
+ conn.response :json, content_type: /\bjson$/
24
24
 
25
25
  conn.adapter Faraday.default_adapter
26
26
  end
data/lib/pocket/oauth.rb CHANGED
@@ -2,7 +2,7 @@ module Pocket
2
2
  # Defines HTTP request methods
3
3
  module OAuth
4
4
  # Return URL for OAuth authorization
5
- def authorize_url(options={})
5
+ def authorize_url(options = {})
6
6
  params = access_token_params.merge(options)
7
7
  params.delete(:consumer_key) # shouldn't be exposed publically
8
8
  # Pocket renames `code` to `request_token` for some reason in this call
@@ -11,34 +11,34 @@ module Pocket
11
11
  end
12
12
 
13
13
  # Return a Pocket code
14
- def get_code(options={})
14
+ def get_code(options = {})
15
15
  params = access_token_params.merge(options)
16
- response = connection.post 'oauth/request', params
16
+ response = connection.post "oauth/request", params
17
17
  results = Hash[URI.decode_www_form(response.body)]
18
- code = results['code']
18
+ results["code"]
19
19
  end
20
20
 
21
21
  # Return an access token from authorization
22
- def get_access_token(code, options={})
23
- params = access_token_params.merge(:code => code).merge(options)
24
- response = connection.post 'oauth/authorize', params
22
+ def get_access_token(code, options = {})
23
+ params = access_token_params.merge(code: code).merge(options)
24
+ response = connection.post "oauth/authorize", params
25
25
  results = Hash[URI.decode_www_form(response.body)]
26
- access_token = results['access_token']
26
+ results["access_token"]
27
27
  end
28
28
 
29
29
  # Return result from authorization
30
- def get_result(code, options={})
31
- params = access_token_params.merge(:code => code).merge(options)
32
- response = connection.post 'oauth/authorize', params
33
- results = Hash[URI.decode_www_form(response.body)]
30
+ def get_result(code, options = {})
31
+ params = access_token_params.merge(code: code).merge(options)
32
+ response = connection.post "oauth/authorize", params
33
+ Hash[URI.decode_www_form(response.body)]
34
34
  end
35
35
 
36
36
  private
37
37
 
38
38
  def access_token_params
39
39
  {
40
- :consumer_key => consumer_key,
41
- :redirect_uri => redirect_uri
40
+ consumer_key: consumer_key,
41
+ redirect_uri: redirect_uri
42
42
  }
43
43
  end
44
44
  end
@@ -1,3 +1,3 @@
1
1
  module Pocket
2
- VERSION = '0.0.7'
2
+ VERSION = "0.0.8"
3
3
  end
data/pocket-ruby.gemspec CHANGED
@@ -1,25 +1,26 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/pocket/version', __FILE__)
1
+ require File.expand_path("../lib/pocket/version", __FILE__)
3
2
 
4
3
  Gem::Specification.new do |s|
5
- s.add_development_dependency('sinatra', '~> 1.3.3')
6
- s.add_development_dependency('multi_xml')
7
- s.add_runtime_dependency('faraday', ['>= 0.7'])
8
- s.add_runtime_dependency('faraday_middleware')
9
- s.add_runtime_dependency('multi_json', '>= 1.0.3', '~> 1.0')
10
- s.add_runtime_dependency('hashie', '>= 0.4.0')
11
- s.authors = ["Turadg Aleahmad","Jason Ng PT"]
12
- s.description = %q{A Ruby wrapper for the Pocket API v3 (Add, Modify and Retrieve)}
13
- s.email = ['turadg@aleahmad.net',"me@jasonngpt.com"]
14
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
4
+ s.add_development_dependency("sinatra", "~> 1.3.3")
5
+ s.add_development_dependency("multi_xml")
6
+ s.add_development_dependency("rake")
7
+ s.add_development_dependency("test-unit")
8
+ s.add_development_dependency("standardrb")
9
+ s.add_runtime_dependency("faraday", [">= 0.7"])
10
+ s.add_runtime_dependency("faraday_middleware")
11
+ s.add_runtime_dependency("multi_json", ">= 1.0.3", "~> 1.0")
12
+ s.authors = ["Turadg Aleahmad", "Jason Ng PT", "Andy Waite"]
13
+ s.description = "A Ruby wrapper for the Pocket API v3 (Add, Modify and Retrieve)"
14
+ s.email = ["turadg@aleahmad.net", "me@jasonngpt.com"]
15
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
15
16
  s.files = `git ls-files`.split("\n")
16
- s.homepage = 'https://github.com/turadg/pocket-ruby'
17
- s.name = 'pocket-ruby-andyw8'
17
+ s.homepage = "https://github.com/turadg/pocket-ruby"
18
+ s.name = "pocket-ruby-andyw8"
18
19
  s.platform = Gem::Platform::RUBY
19
- s.require_paths = ['lib']
20
- s.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if s.respond_to? :required_rubygems_version=
20
+ s.require_paths = ["lib"]
21
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.3.6") if s.respond_to? :required_rubygems_version=
21
22
  s.rubyforge_project = s.name
22
- s.summary = %q{Ruby wrapper for the Pocket API v3}
23
+ s.summary = "Ruby wrapper for the Pocket API v3"
23
24
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
24
25
  s.version = Pocket::VERSION
25
26
  end
@@ -0,0 +1,9 @@
1
+ require "test_helper"
2
+
3
+ module Pocket
4
+ class VersionTest < Test::Unit::TestCase
5
+ def test_specifies_a_version
6
+ assert Pocket::VERSION
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
4
+ require "pocket-ruby"
5
+
6
+ require "test-unit"
metadata CHANGED
@@ -1,11 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pocket-ruby-andyw8
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Turadg Aleahmad
8
8
  - Jason Ng PT
9
+ - Andy Waite
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
@@ -39,6 +40,48 @@ dependencies:
39
40
  - - ">="
40
41
  - !ruby/object:Gem::Version
41
42
  version: '0'
43
+ - !ruby/object:Gem::Dependency
44
+ name: rake
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ type: :development
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ - !ruby/object:Gem::Dependency
58
+ name: test-unit
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ type: :development
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ - !ruby/object:Gem::Dependency
72
+ name: standardrb
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
42
85
  - !ruby/object:Gem::Dependency
43
86
  name: faraday
44
87
  requirement: !ruby/object:Gem::Requirement
@@ -87,20 +130,6 @@ dependencies:
87
130
  - - ">="
88
131
  - !ruby/object:Gem::Version
89
132
  version: 1.0.3
90
- - !ruby/object:Gem::Dependency
91
- name: hashie
92
- requirement: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: 0.4.0
97
- type: :runtime
98
- prerelease: false
99
- version_requirements: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: 0.4.0
104
133
  description: A Ruby wrapper for the Pocket API v3 (Add, Modify and Retrieve)
105
134
  email:
106
135
  - turadg@aleahmad.net
@@ -109,10 +138,13 @@ executables: []
109
138
  extensions: []
110
139
  extra_rdoc_files: []
111
140
  files:
141
+ - ".github/workflows/changelog-checker.yml"
142
+ - ".github/workflows/main.yml"
112
143
  - ".gitignore"
113
144
  - ".yardopts"
114
145
  - CHANGELOG.md
115
146
  - Gemfile
147
+ - Gemfile.lock
116
148
  - LICENSE.md
117
149
  - README.md
118
150
  - Rakefile
@@ -131,6 +163,8 @@ files:
131
163
  - lib/pocket/oauth.rb
132
164
  - lib/pocket/version.rb
133
165
  - pocket-ruby.gemspec
166
+ - test/pocket/version_test.rb
167
+ - test/test_helper.rb
134
168
  homepage: https://github.com/turadg/pocket-ruby
135
169
  licenses: []
136
170
  metadata: {}
@@ -153,4 +187,6 @@ rubygems_version: 3.0.3
153
187
  signing_key:
154
188
  specification_version: 4
155
189
  summary: Ruby wrapper for the Pocket API v3
156
- test_files: []
190
+ test_files:
191
+ - test/pocket/version_test.rb
192
+ - test/test_helper.rb