quaderno 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -53,10 +53,11 @@ Quaderno-ruby parses all the json responses in human readable data, so you can a
53
53
 
54
54
  ### Getting contacts
55
55
  ```ruby
56
- Quaderno::Contact.all(1) #=> Array
56
+ Quaderno::Contact.all() #=> Array
57
+ Quaderno::Contact.all(page: 1) #=> Array
57
58
  ```
58
59
 
59
- will return an array with all your contacts on the first page.
60
+ will return an array with all your contacts on the first page. You can also pass query strings using the attribute :q in order to filter the results by contact name.
60
61
 
61
62
  ### Finding a contact
62
63
  ```ruby
@@ -86,16 +87,57 @@ will update the specified contact with the data of the hash passed as second par
86
87
 
87
88
  will delete the contact with the id passed as parameter.
88
89
 
89
-
90
+ ## Managing items
91
+
92
+ ### Getting items
93
+ ```ruby
94
+ Quaderno::Item #=> Array
95
+ ```
96
+
97
+ will return an array with all your items.
98
+
99
+ ### Finding an item
100
+ ```ruby
101
+ Quaderno::Item.find(id) #=> Quaderno::Item
102
+ ```
103
+
104
+ will return the items with the id passed as parameter.
105
+
106
+
107
+ will return the contact with the id passed as parameter.
108
+
109
+ ### Creating a new item
110
+ ```ruby
111
+ Quaderno::Item.create(params) #=> Quaderno::Item
112
+ ```
113
+
114
+ will create an item using the information of the hash passed as parameter and return an instance of Quaderno::Item with the created contact.
115
+
116
+ ### Updating an existing item
117
+ ```ruby
118
+ Quaderno::Item.update(id, params) #=> Quaderno::Item
119
+ ```
120
+
121
+ will update the specified item with the data of the hash passed as second parameter.
122
+
123
+ ### Deleting an item
124
+ ```ruby
125
+ Quaderno::Item.delete(id) #=> Boolean
126
+ ```
127
+
128
+ will delete the item with the id passed as parameter.
129
+
130
+
90
131
  ## Managing invoices
91
132
 
92
133
  ### Getting invoices
93
134
  ```ruby
94
- Quaderno::Invoice.all(1) #=> Array
135
+ Quaderno::Invoice.all #=> Array
136
+ Quaderno::Invoice.all(page: 1) #=> Array
95
137
  ```
96
138
 
97
- will return an array with all your invoices on the first page.
98
-
139
+ will return an array with all your invoices on the first page. You can also pass query strings using the attribute :q in order to filter the results by contact name, :state to filter by state or :date to filter by date
140
+
99
141
  ### Finding an invoice
100
142
  ```ruby
101
143
  Quaderno::Invoice.find(id) #=> Quaderno::Invoice
@@ -159,7 +201,8 @@ In order to remove a payment you will need the Invoice instance you want to upd
159
201
 
160
202
  ### Getting estimates
161
203
  ```ruby
162
- Quaderno::Estimate.all(1) #=> Array
204
+ Quaderno::Estimate.all() #=> Array
205
+ Quaderno::Estimate.all(page: 1) #=> Array
163
206
  ```
164
207
 
165
208
  will return an array with all your estimates on the first page.
@@ -225,10 +268,11 @@ In order to remove a payment you will need the estimate you want to update.
225
268
 
226
269
  ### Getting expenses
227
270
  ```ruby
228
- Quaderno::Expense.all(1) #=> Array
271
+ Quaderno::Expense.all() #=> Array
272
+ Quaderno::Expense.all(page: 1) #=> Array
229
273
  ```
230
274
 
231
- will return an array with all your expenses on the first page.
275
+ will return an array with all your expenses on the first page. You can also pass query strings using the attribute :q in order to filter the results by contact name, :state to filter by state or :date to filter by date.
232
276
 
233
277
  ### Finding an expense
234
278
  ```ruby
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.1.1
data/build_install.sh CHANGED
@@ -1,2 +1,2 @@
1
1
  gem build quaderno.gemspec
2
- gem install quaderno-1.0.0.gem
2
+ gem install quaderno-1.1.0.gem
@@ -7,7 +7,7 @@ module Quaderno
7
7
  include Quaderno::Exceptions
8
8
  include Quaderno::Behavior::Crud
9
9
 
10
- base_uri 'https://quadernoapp.com/'
10
+ base_uri 'http://localhost:3000' #https://quadernoapp.com/'
11
11
  @@auth_token = nil
12
12
  @@subdomain = nil
13
13
  @@rate_limit_info = nil
@@ -28,12 +28,8 @@ module Quaderno
28
28
  element['contact'] = contact
29
29
  end
30
30
 
31
- def all(page_number = nil)
32
- if page_number
33
- party_response = get("/#{ api_model.subdomain }/api/v1/#{ api_model.api_path }.json?page=#{page_number}", basic_auth: { username: api_model.auth_token })
34
- else
35
- party_response = get("/#{ api_model.subdomain }/api/v1/#{ api_model.api_path }.json", basic_auth: { username: api_model.auth_token })
36
- end
31
+ def all(filter = nil)
32
+ party_response = get("/#{ api_model.subdomain }/api/v1/#{ api_model.api_path }.json", body: filter, basic_auth: { username: api_model.auth_token })
37
33
  check_exception_for(party_response, { rate_limit: true, subdomain_or_token: true })
38
34
  array = JSON::parse party_response.body
39
35
  collection = []
Binary file
data/quaderno.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "quaderno"
8
- s.version = "1.1.0"
8
+ s.version = "1.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Recrea"]
@@ -39,6 +39,7 @@ Gem::Specification.new do |s|
39
39
  "lib/quaderno-ruby/item.rb",
40
40
  "lib/quaderno-ruby/payment.rb",
41
41
  "quaderno-1.0.0.gem",
42
+ "quaderno-1.1.0.gem",
42
43
  "quaderno.gemspec",
43
44
  "test/fixtures/quaderno_cassettes/all_contacts.yml",
44
45
  "test/fixtures/quaderno_cassettes/all_estimates.yml",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quaderno
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -169,6 +169,7 @@ files:
169
169
  - lib/quaderno-ruby/item.rb
170
170
  - lib/quaderno-ruby/payment.rb
171
171
  - quaderno-1.0.0.gem
172
+ - quaderno-1.1.0.gem
172
173
  - quaderno.gemspec
173
174
  - test/fixtures/quaderno_cassettes/all_contacts.yml
174
175
  - test/fixtures/quaderno_cassettes/all_estimates.yml
@@ -224,7 +225,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
224
225
  version: '0'
225
226
  segments:
226
227
  - 0
227
- hash: 1399084077957568219
228
+ hash: -3768300375904323931
228
229
  required_rubygems_version: !ruby/object:Gem::Requirement
229
230
  none: false
230
231
  requirements: