Class: Love::Client

Inherits:
Object
  • Object
show all
Includes:
ResourceURI
Defined in:
lib/love.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ResourceURI

#collection_uri, #singleton_uri

Constructor Details

#initialize(account, api_key, options = {}) ⇒ Client

Returns a new instance of Client.



54
55
56
57
58
59
# File 'lib/love.rb', line 54

def initialize(, api_key, options = {})
  @account, @api_key = , api_key

  # Handle options
  @sleep_between_requests = options[:sleep_between_requests] || 0.5
end

Instance Attribute Details

#accountObject (readonly)

Returns the value of attribute account.



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

def 
  @account
end

#api_keyObject (readonly)

Returns the value of attribute api_key.



50
51
52
# File 'lib/love.rb', line 50

def api_key
  @api_key
end

#sleep_between_requestsObject

Returns the value of attribute sleep_between_requests.



52
53
54
# File 'lib/love.rb', line 52

def sleep_between_requests
  @sleep_between_requests
end

Instance Method Details

#each_category(options = {}, &block) ⇒ Object



77
78
79
# File 'lib/love.rb', line 77

def each_category(options = {}, &block)
  buffered_each(collection_uri('categories'), 'categories', options, &block)
end

#each_discussion(options = {}, &block) ⇒ Object



89
90
91
# File 'lib/love.rb', line 89

def each_discussion(options = {}, &block)
  buffered_each(collection_uri('discussions'), 'discussions', options, &block)
end

#each_queue(options = {}, &block) ⇒ Object



81
82
83
# File 'lib/love.rb', line 81

def each_queue(options = {}, &block)
  buffered_each(collection_uri('queues'), 'named_queues', options, &block)
end

#each_user(options = {}, &block) ⇒ Object



85
86
87
# File 'lib/love.rb', line 85

def each_user(options = {}, &block)
  buffered_each(collection_uri('users'), 'users', options, &block)
end

#get_category(id_or_href, options = {}) ⇒ Object



69
70
71
# File 'lib/love.rb', line 69

def get_category(id_or_href, options = {})
  get(singleton_uri(id_or_href, 'categories'))
end

#get_discussion(id_or_href, options = {}) ⇒ Object



65
66
67
# File 'lib/love.rb', line 65

def get_discussion(id_or_href, options = {})
  get(singleton_uri(id_or_href, 'discussions'))
end

#get_queue(id_or_href, options = {}) ⇒ Object



73
74
75
# File 'lib/love.rb', line 73

def get_queue(id_or_href, options = {})
  get(singleton_uri(id_or_href, 'queues'), options)
end

#get_user(id_or_href, options = {}) ⇒ Object



61
62
63
# File 'lib/love.rb', line 61

def get_user(id_or_href, options = {})
  get(singleton_uri(id_or_href, 'users'))
end