Class: Hashblue::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/hashblue/client.rb

Defined Under Namespace

Classes: RequestError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access_token) ⇒ Client

Returns a new instance of Client.



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

def initialize(access_token)
  @access_token = access_token
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



24
25
26
# File 'lib/hashblue/client.rb', line 24

def access_token
  @access_token
end

Instance Method Details

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



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

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

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



42
43
44
# File 'lib/hashblue/client.rb', line 42

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

#head(path, query = {}) ⇒ Object



38
39
40
# File 'lib/hashblue/client.rb', line 38

def head(path, query = {})
  request :head, path, query
end

#load_contacts(uri, query = {}) ⇒ Object



34
35
36
# File 'lib/hashblue/client.rb', line 34

def load_contacts(uri, query = {})
  Collection.new(self, Contact, get(uri, query), "contacts")
end

#load_messages(uri, query = {}) ⇒ Object



30
31
32
# File 'lib/hashblue/client.rb', line 30

def load_messages(uri, query = {})
  Collection.new(self, Message, get(uri, query), "messages")
end

#post(path, query, body) ⇒ Object



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

def post(path, query, body)
  request :post, path, query, body
end

#put(path, query, body) ⇒ Object



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

def put(path, query, body)
  request :put, path, query, body
end