ynab 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +34 -4
- data/config.json +1 -1
- data/docs/ScheduledTransactionDetail.md +1 -1
- data/docs/ScheduledTransactionSummary.md +1 -1
- data/docs/TransactionDetail.md +1 -1
- data/docs/TransactionSummary.md +1 -1
- data/docs/TransactionsApi.md +62 -0
- data/docs/User.md +8 -0
- data/docs/UserApi.md +57 -0
- data/docs/UserResponse.md +8 -0
- data/docs/UserWrapper.md +8 -0
- data/lib/ynab.rb +6 -0
- data/lib/ynab/api/transactions_api.rb +62 -0
- data/lib/ynab/api/user_api.rb +70 -0
- data/lib/ynab/models/account.rb +2 -2
- data/lib/ynab/models/scheduled_transaction_detail.rb +13 -0
- data/lib/ynab/models/scheduled_transaction_summary.rb +13 -0
- data/lib/ynab/models/transaction_detail.rb +13 -0
- data/lib/ynab/models/transaction_summary.rb +13 -0
- data/lib/ynab/models/user.rb +193 -0
- data/lib/ynab/models/user_response.rb +193 -0
- data/lib/ynab/models/user_wrapper.rb +193 -0
- data/lib/ynab/version.rb +1 -1
- data/spec-v1-swagger.json +120 -6
- metadata +10 -2
@@ -0,0 +1,193 @@
|
|
1
|
+
=begin
|
2
|
+
#YNAB API Endpoints
|
3
|
+
|
4
|
+
#Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module YnabApi
|
16
|
+
|
17
|
+
class UserWrapper
|
18
|
+
attr_accessor :user
|
19
|
+
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'user' => :'user'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Attribute type mapping.
|
29
|
+
def self.swagger_types
|
30
|
+
{
|
31
|
+
:'user' => :'User'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# Initializes the object
|
36
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
37
|
+
def initialize(attributes = {})
|
38
|
+
return unless attributes.is_a?(Hash)
|
39
|
+
|
40
|
+
# convert string to symbol for hash key
|
41
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
42
|
+
|
43
|
+
if attributes.has_key?(:'user')
|
44
|
+
self.user = attributes[:'user']
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
50
|
+
# @return Array for valid properties with the reasons
|
51
|
+
def list_invalid_properties
|
52
|
+
invalid_properties = Array.new
|
53
|
+
if @user.nil?
|
54
|
+
invalid_properties.push("invalid value for 'user', user cannot be nil.")
|
55
|
+
end
|
56
|
+
|
57
|
+
return invalid_properties
|
58
|
+
end
|
59
|
+
|
60
|
+
# Check to see if the all the properties in the model are valid
|
61
|
+
# @return true if the model is valid
|
62
|
+
def valid?
|
63
|
+
return false if @user.nil?
|
64
|
+
return true
|
65
|
+
end
|
66
|
+
|
67
|
+
# Checks equality by comparing each attribute.
|
68
|
+
# @param [Object] Object to be compared
|
69
|
+
def ==(o)
|
70
|
+
return true if self.equal?(o)
|
71
|
+
self.class == o.class &&
|
72
|
+
user == o.user
|
73
|
+
end
|
74
|
+
|
75
|
+
# @see the `==` method
|
76
|
+
# @param [Object] Object to be compared
|
77
|
+
def eql?(o)
|
78
|
+
self == o
|
79
|
+
end
|
80
|
+
|
81
|
+
# Calculates hash code according to all attributes.
|
82
|
+
# @return [Fixnum] Hash code
|
83
|
+
def hash
|
84
|
+
[user].hash
|
85
|
+
end
|
86
|
+
|
87
|
+
# Builds the object from hash
|
88
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
89
|
+
# @return [Object] Returns the model itself
|
90
|
+
def build_from_hash(attributes)
|
91
|
+
return nil unless attributes.is_a?(Hash)
|
92
|
+
self.class.swagger_types.each_pair do |key, type|
|
93
|
+
if type =~ /\AArray<(.*)>/i
|
94
|
+
# check to ensure the input is an array given that the the attribute
|
95
|
+
# is documented as an array but the input is not
|
96
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
97
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
98
|
+
end
|
99
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
100
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
101
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
102
|
+
end
|
103
|
+
|
104
|
+
self
|
105
|
+
end
|
106
|
+
|
107
|
+
# Deserializes the data based on type
|
108
|
+
# @param string type Data type
|
109
|
+
# @param string value Value to be deserialized
|
110
|
+
# @return [Object] Deserialized data
|
111
|
+
def _deserialize(type, value)
|
112
|
+
case type.to_sym
|
113
|
+
when :DateTime
|
114
|
+
DateTime.parse(value)
|
115
|
+
when :Date
|
116
|
+
Date.parse(value)
|
117
|
+
when :String
|
118
|
+
value.to_s
|
119
|
+
when :Integer
|
120
|
+
value.to_i
|
121
|
+
when :Float
|
122
|
+
value.to_f
|
123
|
+
when :BOOLEAN
|
124
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
125
|
+
true
|
126
|
+
else
|
127
|
+
false
|
128
|
+
end
|
129
|
+
when :Object
|
130
|
+
# generic object (usually a Hash), return directly
|
131
|
+
value
|
132
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
133
|
+
inner_type = Regexp.last_match[:inner_type]
|
134
|
+
value.map { |v| _deserialize(inner_type, v) }
|
135
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
136
|
+
k_type = Regexp.last_match[:k_type]
|
137
|
+
v_type = Regexp.last_match[:v_type]
|
138
|
+
{}.tap do |hash|
|
139
|
+
value.each do |k, v|
|
140
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
else # model
|
144
|
+
temp_model = YnabApi.const_get(type).new
|
145
|
+
temp_model.build_from_hash(value)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
# Returns the string representation of the object
|
150
|
+
# @return [String] String presentation of the object
|
151
|
+
def to_s
|
152
|
+
to_hash.to_s
|
153
|
+
end
|
154
|
+
|
155
|
+
# to_body is an alias to to_hash (backward compatibility)
|
156
|
+
# @return [Hash] Returns the object in the form of hash
|
157
|
+
def to_body
|
158
|
+
to_hash
|
159
|
+
end
|
160
|
+
|
161
|
+
# Returns the object in the form of hash
|
162
|
+
# @return [Hash] Returns the object in the form of hash
|
163
|
+
def to_hash
|
164
|
+
hash = {}
|
165
|
+
self.class.attribute_map.each_pair do |attr, param|
|
166
|
+
value = self.send(attr)
|
167
|
+
next if value.nil?
|
168
|
+
hash[param] = _to_hash(value)
|
169
|
+
end
|
170
|
+
hash
|
171
|
+
end
|
172
|
+
|
173
|
+
# Outputs non-array value in the form of hash
|
174
|
+
# For object, use to_hash. Otherwise, just return the value
|
175
|
+
# @param [Object] value Any valid value
|
176
|
+
# @return [Hash] Returns the value in the form of hash
|
177
|
+
def _to_hash(value)
|
178
|
+
if value.is_a?(Array)
|
179
|
+
value.compact.map{ |v| _to_hash(v) }
|
180
|
+
elsif value.is_a?(Hash)
|
181
|
+
{}.tap do |hash|
|
182
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
183
|
+
end
|
184
|
+
elsif value.respond_to? :to_hash
|
185
|
+
value.to_hash
|
186
|
+
else
|
187
|
+
value
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
end
|
192
|
+
|
193
|
+
end
|
data/lib/ynab/version.rb
CHANGED
data/spec-v1-swagger.json
CHANGED
@@ -10,6 +10,9 @@
|
|
10
10
|
"host": "api.youneedabudget.com",
|
11
11
|
"basePath": "/v1",
|
12
12
|
"tags": [
|
13
|
+
{
|
14
|
+
"name": "User"
|
15
|
+
},
|
13
16
|
{
|
14
17
|
"name": "Budgets"
|
15
18
|
},
|
@@ -50,6 +53,29 @@
|
|
50
53
|
}
|
51
54
|
],
|
52
55
|
"paths": {
|
56
|
+
"/user": {
|
57
|
+
"get": {
|
58
|
+
"tags": ["User"],
|
59
|
+
"summary": "User info",
|
60
|
+
"description": "Returns authenticated user information.",
|
61
|
+
"operationId": "getUser",
|
62
|
+
"produces": ["application/json"],
|
63
|
+
"responses": {
|
64
|
+
"200": {
|
65
|
+
"description": "The user info.",
|
66
|
+
"schema": {
|
67
|
+
"$ref": "#/definitions/UserResponse"
|
68
|
+
}
|
69
|
+
},
|
70
|
+
"default": {
|
71
|
+
"description": "An error occurred.",
|
72
|
+
"schema": {
|
73
|
+
"$ref": "#/definitions/ErrorResponse"
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
},
|
53
79
|
"/budgets": {
|
54
80
|
"get": {
|
55
81
|
"tags": ["Budgets"],
|
@@ -737,8 +763,7 @@
|
|
737
763
|
],
|
738
764
|
"responses": {
|
739
765
|
"201": {
|
740
|
-
"description":
|
741
|
-
"The bulk request was processed sucessfully.",
|
766
|
+
"description": "The bulk request was processed sucessfully.",
|
742
767
|
"schema": {
|
743
768
|
"$ref": "#/definitions/BulkResponse"
|
744
769
|
}
|
@@ -862,6 +887,61 @@
|
|
862
887
|
}
|
863
888
|
}
|
864
889
|
},
|
890
|
+
"/budgets/{budget_id}/payees/{payee_id}/transactions": {
|
891
|
+
"get": {
|
892
|
+
"tags": ["Transactions"],
|
893
|
+
"summary": "List payee transactions",
|
894
|
+
"description": "Returns all transactions for a specified payee",
|
895
|
+
"operationId": "getTransactionsByPayee",
|
896
|
+
"produces": ["application/json"],
|
897
|
+
"parameters": [
|
898
|
+
{
|
899
|
+
"name": "budget_id",
|
900
|
+
"in": "path",
|
901
|
+
"description": "The ID of the Budget.",
|
902
|
+
"required": true,
|
903
|
+
"type": "string",
|
904
|
+
"format": "uuid"
|
905
|
+
},
|
906
|
+
{
|
907
|
+
"name": "payee_id",
|
908
|
+
"in": "path",
|
909
|
+
"description": "The ID of the Payee.",
|
910
|
+
"required": true,
|
911
|
+
"type": "string",
|
912
|
+
"format": "uuid"
|
913
|
+
},
|
914
|
+
{
|
915
|
+
"name": "since_date",
|
916
|
+
"in": "query",
|
917
|
+
"description": "Only return transactions on or after this date.",
|
918
|
+
"required": false,
|
919
|
+
"type": "string",
|
920
|
+
"format": "date"
|
921
|
+
}
|
922
|
+
],
|
923
|
+
"responses": {
|
924
|
+
"200": {
|
925
|
+
"description": "The list of requested Transactions.",
|
926
|
+
"schema": {
|
927
|
+
"$ref": "#/definitions/TransactionsResponse"
|
928
|
+
}
|
929
|
+
},
|
930
|
+
"404": {
|
931
|
+
"description": "No Transactions were found.",
|
932
|
+
"schema": {
|
933
|
+
"$ref": "#/definitions/ErrorResponse"
|
934
|
+
}
|
935
|
+
},
|
936
|
+
"default": {
|
937
|
+
"description": "An error occurred.",
|
938
|
+
"schema": {
|
939
|
+
"$ref": "#/definitions/ErrorResponse"
|
940
|
+
}
|
941
|
+
}
|
942
|
+
}
|
943
|
+
}
|
944
|
+
},
|
865
945
|
"/budgets/{budget_id}/transactions/{transaction_id}": {
|
866
946
|
"get": {
|
867
947
|
"tags": ["Transactions"],
|
@@ -1076,6 +1156,34 @@
|
|
1076
1156
|
}
|
1077
1157
|
}
|
1078
1158
|
},
|
1159
|
+
"UserResponse": {
|
1160
|
+
"type": "object",
|
1161
|
+
"required": ["data"],
|
1162
|
+
"properties": {
|
1163
|
+
"data": {
|
1164
|
+
"$ref": "#/definitions/UserWrapper"
|
1165
|
+
}
|
1166
|
+
}
|
1167
|
+
},
|
1168
|
+
"UserWrapper": {
|
1169
|
+
"type": "object",
|
1170
|
+
"required": ["user"],
|
1171
|
+
"properties": {
|
1172
|
+
"user": {
|
1173
|
+
"$ref": "#/definitions/User"
|
1174
|
+
}
|
1175
|
+
}
|
1176
|
+
},
|
1177
|
+
"User": {
|
1178
|
+
"type": "object",
|
1179
|
+
"required": ["id"],
|
1180
|
+
"properties": {
|
1181
|
+
"id": {
|
1182
|
+
"type": "string",
|
1183
|
+
"format": "uuid"
|
1184
|
+
}
|
1185
|
+
}
|
1186
|
+
},
|
1079
1187
|
"BudgetSummaryResponse": {
|
1080
1188
|
"type": "object",
|
1081
1189
|
"required": ["data"],
|
@@ -1133,7 +1241,8 @@
|
|
1133
1241
|
"last_modified_on": {
|
1134
1242
|
"type": "string",
|
1135
1243
|
"format": "date-time",
|
1136
|
-
"description":
|
1244
|
+
"description":
|
1245
|
+
"The last time any changes were made to the budget from either a web or mobile client."
|
1137
1246
|
},
|
1138
1247
|
"date_format": {
|
1139
1248
|
"$ref": "#/definitions/DateFormat"
|
@@ -1301,6 +1410,7 @@
|
|
1301
1410
|
"cash",
|
1302
1411
|
"lineOfCredit",
|
1303
1412
|
"merchantAccount",
|
1413
|
+
"payPal",
|
1304
1414
|
"investmentAccount",
|
1305
1415
|
"mortgage",
|
1306
1416
|
"otherAsset",
|
@@ -1656,7 +1766,9 @@
|
|
1656
1766
|
"description": "Whether or not the transaction is approved"
|
1657
1767
|
},
|
1658
1768
|
"flag_color": {
|
1659
|
-
"type": "string"
|
1769
|
+
"type": "string",
|
1770
|
+
"enum": ["red", "orange", "yellow", "green", "blue", "purple", null],
|
1771
|
+
"description": "The transaction flag"
|
1660
1772
|
},
|
1661
1773
|
"account_id": {
|
1662
1774
|
"type": "string",
|
@@ -1758,7 +1870,7 @@
|
|
1758
1870
|
},
|
1759
1871
|
"flag_color": {
|
1760
1872
|
"type": "string",
|
1761
|
-
"enum": ["red", "orange", "yellow", "green", "blue", "purple"],
|
1873
|
+
"enum": ["red", "orange", "yellow", "green", "blue", "purple", null],
|
1762
1874
|
"description": "The transaction flag"
|
1763
1875
|
},
|
1764
1876
|
"import_id": {
|
@@ -1961,7 +2073,9 @@
|
|
1961
2073
|
"type": "string"
|
1962
2074
|
},
|
1963
2075
|
"flag_color": {
|
1964
|
-
"type": "string"
|
2076
|
+
"type": "string",
|
2077
|
+
"enum": ["red", "orange", "yellow", "green", "blue", "purple", null],
|
2078
|
+
"description": "The scheduled transaction flag"
|
1965
2079
|
},
|
1966
2080
|
"account_id": {
|
1967
2081
|
"type": "string",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ynab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- You Need A Budget, LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -171,6 +171,10 @@ files:
|
|
171
171
|
- docs/TransactionsApi.md
|
172
172
|
- docs/TransactionsResponse.md
|
173
173
|
- docs/TransactionsWrapper.md
|
174
|
+
- docs/User.md
|
175
|
+
- docs/UserApi.md
|
176
|
+
- docs/UserResponse.md
|
177
|
+
- docs/UserWrapper.md
|
174
178
|
- examples/budget-list.rb
|
175
179
|
- examples/budget-month.rb
|
176
180
|
- examples/category-balance.rb
|
@@ -183,6 +187,7 @@ files:
|
|
183
187
|
- lib/ynab/api/payees_api.rb
|
184
188
|
- lib/ynab/api/scheduled_transactions_api.rb
|
185
189
|
- lib/ynab/api/transactions_api.rb
|
190
|
+
- lib/ynab/api/user_api.rb
|
186
191
|
- lib/ynab/api_client.rb
|
187
192
|
- lib/ynab/api_error.rb
|
188
193
|
- lib/ynab/configuration.rb
|
@@ -246,6 +251,9 @@ files:
|
|
246
251
|
- lib/ynab/models/transaction_wrapper.rb
|
247
252
|
- lib/ynab/models/transactions_response.rb
|
248
253
|
- lib/ynab/models/transactions_wrapper.rb
|
254
|
+
- lib/ynab/models/user.rb
|
255
|
+
- lib/ynab/models/user_response.rb
|
256
|
+
- lib/ynab/models/user_wrapper.rb
|
249
257
|
- lib/ynab/version.rb
|
250
258
|
- spec-v1-swagger.json
|
251
259
|
- spec/api/accounts_spec.rb
|