Class: Buff::Client

Inherits:
Object
  • Object
show all
Includes:
Core, Link, Profile, Update, User, Error
Defined in:
lib/buff.rb,
lib/buff/core.rb,
lib/buff/link.rb,
lib/buff/user.rb,
lib/buff/update.rb,
lib/buff/profile.rb

Defined Under Namespace

Modules: Core, Link, Profile, Update, User

Constant Summary

Constants included from Core

Core::API_VERSION, Core::ERROR_TABLE

Instance Attribute Summary collapse

Attributes included from Core

#error_table

Instance Method Summary collapse

Methods included from Link

#link

Methods included from Update

#check_id, #create_update, #destroy_update, #interactions_by_update_id, #modify_update_text, #reorder_updates, #share_update, #shuffle_updates, #update_by_id, #updates_by_profile_id

Methods included from Profile

#profile_by_id, #profile_schedules_by_id, #profiles, #set_schedules

Methods included from User

#user_info

Methods included from Core

#basic_request, error_table, #get, #handle_response_code, #interpret_response, #post

Constructor Details

#initialize(access_token) ⇒ Client

Returns a new instance of Client.



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

def initialize(access_token)
  @access_token = access_token
  @conn = Faraday.new(:url => "https://api.bufferapp.com/1/") do |faraday|
      faraday.request  :url_encoded             # form-encode POST params
      faraday.adapter  Faraday.default_adapter  # make requests with Net::HTTP
  end
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



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

def access_token
  @access_token
end

#auth_queryObject

Returns the value of attribute auth_query.



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

def auth_query
  @auth_query
end

Instance Method Details

#infoObject



66
67
68
69
# File 'lib/buff.rb', line 66

def info
  response = get("/info/configuration.json")
  Buff::Info.new(response)
end