Class: YNAB::API

Inherits:
Object
  • Object
show all
Defined in:
lib/ynab.rb

Direct Known Subclasses

YnabApi::Client

Instance Method Summary collapse

Constructor Details

#initialize(access_token, host = 'api.youneedabudget.com', useHttps = true) ⇒ API

Returns a new instance of API.



111
112
113
114
115
116
117
118
119
120
# File 'lib/ynab.rb', line 111

def initialize(access_token, host = 'api.youneedabudget.com', useHttps = true)
  config = Configuration.default
  config.api_key['Authorization'] = access_token
  config.api_key_prefix['Authorization'] = 'Bearer'
  config.scheme = useHttps ? 'https' : 'http'
  config.host = host
  config.base_path = '/v1'

  @client = ApiClient.new(config)
end

Instance Method Details

#accountsObject



130
131
132
# File 'lib/ynab.rb', line 130

def accounts
  AccountsApi.new(@client)
end

#budgetsObject



126
127
128
# File 'lib/ynab.rb', line 126

def budgets
  BudgetsApi.new(@client)
end

#categoriesObject



134
135
136
# File 'lib/ynab.rb', line 134

def categories
  CategoriesApi.new(@client)
end

#last_requestObject



158
159
160
# File 'lib/ynab.rb', line 158

def last_request
  @client.last_request
end

#monthsObject



138
139
140
# File 'lib/ynab.rb', line 138

def months
  MonthsApi.new(@client)
end

#payee_locationsObject



146
147
148
# File 'lib/ynab.rb', line 146

def payee_locations
  PayeeLocationsApi.new(@client)
end

#payeesObject



142
143
144
# File 'lib/ynab.rb', line 142

def payees
  PayeesApi.new(@client)
end

#scheduled_transactionsObject



154
155
156
# File 'lib/ynab.rb', line 154

def scheduled_transactions
  ScheduledTransactionsApi.new(@client)
end

#transactionsObject



150
151
152
# File 'lib/ynab.rb', line 150

def transactions
  YNAB::Overrides::TransactionsApi.new(@client)
end

#userObject



122
123
124
# File 'lib/ynab.rb', line 122

def user
  UserApi.new(@client)
end