Class: Instapaper::Client

Inherits:
Object
  • Object
show all
Includes:
API, HTTP::Utils
Defined in:
lib/instapaper/client.rb

Overview

Wrapper for the Instapaper REST API

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from API::OAuth

#access_token

Methods included from API::Highlights

#add_highlight, #delete_highlight, #highlights

Methods included from API::Folders

#add_folder, #delete_folder, #folders, #set_order

Methods included from API::Bookmarks

#add_bookmark, #archive_bookmark, #bookmarks, #delete_bookmark, #get_text, #move_bookmark, #star_bookmark, #unarchive_bookmark, #unstar_bookmark, #update_read_progress

Methods included from API::Accounts

#verify_credentials

Constructor Details

#initialize(options = {}) {|_self| ... } ⇒ Instapaper::Client

Initializes a new Client object

Parameters:

  • options (Hash) (defaults to: {})

Yields:

  • (_self)

Yield Parameters:


18
19
20
21
22
23
# File 'lib/instapaper/client.rb', line 18

def initialize(options = {})
  options.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
  yield(self) if block_given?
end

Instance Attribute Details

#consumer_keyObject

Returns the value of attribute consumer_key


11
12
13
# File 'lib/instapaper/client.rb', line 11

def consumer_key
  @consumer_key
end

#consumer_secretObject

Returns the value of attribute consumer_secret


11
12
13
# File 'lib/instapaper/client.rb', line 11

def consumer_secret
  @consumer_secret
end

#oauth_tokenObject

Returns the value of attribute oauth_token


11
12
13
# File 'lib/instapaper/client.rb', line 11

def oauth_token
  @oauth_token
end

#oauth_token_secretObject

Returns the value of attribute oauth_token_secret


11
12
13
# File 'lib/instapaper/client.rb', line 11

def oauth_token_secret
  @oauth_token_secret
end

#proxyObject

Returns the value of attribute proxy


11
12
13
# File 'lib/instapaper/client.rb', line 11

def proxy
  @proxy
end

#user_agentString

Returns:

  • (String)

26
27
28
# File 'lib/instapaper/client.rb', line 26

def user_agent
  @user_agent ||= "InstapaperRubyGem/#{Instapaper::VERSION}"
end

Instance Method Details

#consumer_credentialsHash

Returns:

  • (Hash)

43
44
45
46
47
48
# File 'lib/instapaper/client.rb', line 43

def consumer_credentials
  {
    consumer_key: @consumer_key,
    consumer_secret: @consumer_secret,
  }
end

#credentialsHash

Authentication hash

Returns:

  • (Hash)

33
34
35
36
37
38
39
40
# File 'lib/instapaper/client.rb', line 33

def credentials
  {
    consumer_key: @consumer_key,
    consumer_secret: @consumer_secret,
    oauth_token: @oauth_token,
    oauth_token_secret: @oauth_token_secret,
  }
end

#credentials?Boolean

Returns:

  • (Boolean)

51
52
53
# File 'lib/instapaper/client.rb', line 51

def credentials?
  credentials.values.all?
end