bookafy 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bookafy.rb +2 -0
- data/lib/bookafy/company.rb +29 -0
- data/lib/bookafy/model/company.rb +23 -0
- data/lib/bookafy/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b939d32a3c8eb43c9b9a56c8ee240a754452c7e4
|
|
4
|
+
data.tar.gz: cb257de4b126331cf090bebed35de50c65434e1b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 26cbbf4cbe0016cb741020f0cbe45af7f9e39ed590e72fbe2772a1fa6511750e66ad85f08155fa2c0a3d099c8fb7ef1dfc557198640f73099ff7611a94eada8a
|
|
7
|
+
data.tar.gz: e7cef77cf216d0125aab98f61ef170cf07267c6bd2e1b77376602116e9bbf13cfbcb89b267bda9bb7c1ede695497ceaa747c4de96eac2f0b5d88354b5b2bc300
|
data/lib/bookafy.rb
CHANGED
|
@@ -3,8 +3,10 @@ require "bookafy/base_service"
|
|
|
3
3
|
require "bookafy/model/timestamps"
|
|
4
4
|
require "bookafy/model/customer"
|
|
5
5
|
require "bookafy/model/appointment"
|
|
6
|
+
require "bookafy/model/company"
|
|
6
7
|
require "bookafy/customer"
|
|
7
8
|
require "bookafy/appointment"
|
|
9
|
+
require "bookafy/company"
|
|
8
10
|
|
|
9
11
|
module Bookafy
|
|
10
12
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module Bookafy
|
|
2
|
+
class Company < BaseService
|
|
3
|
+
|
|
4
|
+
def initialize
|
|
5
|
+
super
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def uri
|
|
9
|
+
'company'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def info()
|
|
13
|
+
response = get(uri)
|
|
14
|
+
unless response.code == 200
|
|
15
|
+
return nil
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
response_json = JSON.parse(response.body)['response']
|
|
19
|
+
company_json = response_json['company']
|
|
20
|
+
company = Bookafy::Model::Company.new(company_json)
|
|
21
|
+
|
|
22
|
+
company
|
|
23
|
+
rescue => e
|
|
24
|
+
puts "Error at fetching customers: #{e.message}"
|
|
25
|
+
return nil
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Bookafy
|
|
2
|
+
module Model
|
|
3
|
+
class Company
|
|
4
|
+
include Timestamps
|
|
5
|
+
attr_accessor :id, :name, :created_at, :updated_at
|
|
6
|
+
|
|
7
|
+
def initialize(attrs = {})
|
|
8
|
+
attrs.each do |attr, val|
|
|
9
|
+
send("#{attr}=", val) if respond_to?("#{attr}=")
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def created_at
|
|
15
|
+
Time.parse(attributes[:created_at])
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def updated_at
|
|
19
|
+
Time.parse(attributes[:updated_at])
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
data/lib/bookafy/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bookafy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ivan Bajalovic
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-08-
|
|
11
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -156,8 +156,10 @@ files:
|
|
|
156
156
|
- lib/bookafy.rb
|
|
157
157
|
- lib/bookafy/appointment.rb
|
|
158
158
|
- lib/bookafy/base_service.rb
|
|
159
|
+
- lib/bookafy/company.rb
|
|
159
160
|
- lib/bookafy/customer.rb
|
|
160
161
|
- lib/bookafy/model/appointment.rb
|
|
162
|
+
- lib/bookafy/model/company.rb
|
|
161
163
|
- lib/bookafy/model/customer.rb
|
|
162
164
|
- lib/bookafy/model/timestamps.rb
|
|
163
165
|
- lib/bookafy/version.rb
|