Class: Croudia::Client

Inherits:
Object
  • Object
show all
Includes:
API::Account, API::Favorites, API::Friendships, API::OAuth, API::Search, API::SecretMails, API::Statuses, API::Timelines, API::Trends, 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::Trends

#trends

Methods included from API::Timelines

#home_timeline, #mentions, #public_timeline, #user_timeline

Methods included from API::Statuses

#destroy_status, #share, #share_with_media, #spread, #status, #update, #update_with_media

Methods included from API::SecretMails

#destroy_secret_mail, #secret_mails, #secret_mails_sent, #secret_photo, #send_secret_mail, #send_secret_mail_with_media, #show_secret_mail

Methods included from API::Search

#search, #search_favorites, #search_user, #search_user_by_profile

Methods included from API::OAuth

#authorize_url, #get_access_token

Methods included from API::Friendships

#follow, #follower_ids, #followers, #friend_ids, #friends, #friendship, #friendships, #unfollow

Methods included from API::Favorites

#favorite, #favorites, #unfavorite

Methods included from API::Account

#update_cover_image, #update_profile, #update_profile_image, #verify_credentials

Constructor Details

#initialize(options = {}) ⇒ Client

Initialize a new Client object

Parameters:

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


34
35
36
37
38
# File 'lib/croudia/client.rb', line 34

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



41
42
43
# File 'lib/croudia/client.rb', line 41

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

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

Perform an HTTP GET request



46
47
48
# File 'lib/croudia/client.rb', line 46

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

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

Perform an HTTP POST request



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

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

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

Perform an HTTP PUT request



56
57
58
# File 'lib/croudia/client.rb', line 56

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