Class: Croudia::Client

Inherits:
Object
  • Object
show all
Includes:
API::Account, API::Favorites, API::Friendships, API::OAuth, API::SecretMails, API::Statuses, API::Timelines, API::Users, API::Utils, Configurable
Defined in:
lib/croudia/client.rb

Instance Attribute Summary

Attributes included from Configurable

#access_token, #client_id, #client_secret, #connection_options, #endpoint, #middleware

Instance Method Summary collapse

Methods included from Configurable

#configure, keys, #options, #reset!

Methods included from API::Users

#user, #users

Methods included from API::Timelines

#home_timeline, #mentions, #public_timeline, #user_timeline

Methods included from API::Statuses

#destroy_status, #spread, #status, #update, #update_with_media

Methods included from API::SecretMails

#destroy_secret_mail, #secret_mails, #secret_mails_sent, #send_secret_mail, #show_secret_mail

Methods included from API::OAuth

#authorize_url, #get_access_token

Methods included from API::Friendships

#follow, #friendship, #friendships, #unfollow

Methods included from API::Favorites

#favorite, #favorites, #unfavorite

Methods included from API::Account

#update_profile, #update_profile_image, #verify_credentials

Constructor Details

#initialize(options = {}) ⇒ Croudia::Client

Initialize a new Client object

Parameters:

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


32
33
34
35
36
# File 'lib/croudia/client.rb', line 32

def initialize(options={})
  Croudia::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", options[key] || Croudia.instance_variable_get(:"@#{key}"))
  end
end

Instance Method Details

#delete(path, params = {}) ⇒ Object

Perform an HTTP DELETE request



39
40
41
# File 'lib/croudia/client.rb', line 39

def delete(path, params={})
  request(:delete, path, params)
end

#get(path, params = {}) ⇒ Object

Perform an HTTP GET request



44
45
46
# File 'lib/croudia/client.rb', line 44

def get(path, params={})
  request(:get, path, params)
end

#post(path, params = {}) ⇒ Object

Perform an HTTP POST request



49
50
51
# File 'lib/croudia/client.rb', line 49

def post(path, params={})
  request(:post, path, params)
end

#put(path, params = {}) ⇒ Object

Perform an HTTP PUT request



54
55
56
# File 'lib/croudia/client.rb', line 54

def put(path, params={})
  request(:put, path, params)
end