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.



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

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



128
129
130
# File 'lib/ynab.rb', line 128

def accounts
  AccountsApi.new(@client)
end

#budgetsObject



124
125
126
# File 'lib/ynab.rb', line 124

def budgets
  BudgetsApi.new(@client)
end

#categoriesObject



132
133
134
# File 'lib/ynab.rb', line 132

def categories
  CategoriesApi.new(@client)
end

#last_requestObject



156
157
158
# File 'lib/ynab.rb', line 156

def last_request
  @client.last_request
end

#monthsObject



136
137
138
# File 'lib/ynab.rb', line 136

def months
  MonthsApi.new(@client)
end

#payee_locationsObject



144
145
146
# File 'lib/ynab.rb', line 144

def payee_locations
  PayeeLocationsApi.new(@client)
end

#payeesObject



140
141
142
# File 'lib/ynab.rb', line 140

def payees
  PayeesApi.new(@client)
end

#scheduled_transactionsObject



152
153
154
# File 'lib/ynab.rb', line 152

def scheduled_transactions
  ScheduledTransactionsApi.new(@client)
end

#transactionsObject



148
149
150
# File 'lib/ynab.rb', line 148

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

#userObject



120
121
122
# File 'lib/ynab.rb', line 120

def user
  UserApi.new(@client)
end