youcanbookme 0.0.1.alpha → 0.0.2.alpha

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36f53dab6a17b2b18709b2b46f3b57bee4b27bced5172e1b5b1b478ef930a5ee
4
- data.tar.gz: 7dcd566aa70a702c9fac08b16c8be40006588e1902620be6d9460f68b38f0c8c
3
+ metadata.gz: d3491d5775ccc99d6cd9bf13615ec48e7fcb65d0253b4292e626506b81c49314
4
+ data.tar.gz: 45f1ca0ad6d5cd1c0bad008f63a4bc8dbc62ec311af7f36ddbd49436c4f2c57c
5
5
  SHA512:
6
- metadata.gz: 86cf465f68b4b4d183504f0e5ef0d8cb814fcab79f8e1d8c6935abbf0f2c184d1f073b6026c4d8d3f5ea23b85f7e2756f6511924a1e547476d91956b6d8f08b1
7
- data.tar.gz: 469f6024831bf01e032b14b4bb63d5232fc682cf11522f141536a05da78524f25765ded2c259e0bd910994b0625c4d2b9c39a8a1c54f79efefe0ab0e034e4de4
6
+ metadata.gz: 65ec8367df8622ae84856c41dcb949437aa37e29ae6987b935b207cb07613f670fdc4c416f0a379bbb17929bd6f6f437e2d53cc0117a2b097551e104146c2242
7
+ data.tar.gz: cfc49a92911acb2e580895e4c4ffb28c9f52d192b5d2e00b0dd7d791e8539e3a53ce153f5267c36f59cb7d7629e52585740e40c8bc1e6550bf6fe748378b945a
@@ -1,3 +1,9 @@
1
+ # 0.0.2.alpha
2
+
3
+ - support APIs
4
+ - GET `/v1/{accountId}/profiles`
5
+ - GET `/v1/{accountId}/profiles/{profileId}`
6
+
1
7
  # 0.0.1.alpha
2
8
 
3
9
  - Initial release.
data/README.md CHANGED
@@ -61,9 +61,9 @@ Or install it yourself as:
61
61
  - [ ] GET `/v1/{localAccountId}/remoteaccounts/{remoteAccountId}/calendars/{calendarId}/events/{eventId}`
62
62
  - [ ] DELETE `/v1/{localAccountId}/remoteaccounts/{remoteAccountId}/calendars/{calendarId}/events/{eventId}`
63
63
  - Profile
64
- - [ ] GET `/v1/{accountId}/profiles`
64
+ - [x] GET `/v1/{accountId}/profiles`
65
65
  - [ ] POST `/v1/{accountId}/profiles`
66
- - [ ] GET `/v1/{accountId}/profiles/{profileId}`
66
+ - [x] GET `/v1/{accountId}/profiles/{profileId}`
67
67
  - [ ] PATCH `/v1/{accountId}/profiles/{profileId}`
68
68
  - [ ] DELETE `/v1/{accountId}/profiles/{profileId}`
69
69
  - [x] GET `/v1/subdomains/{subdomain}`
@@ -20,29 +20,54 @@ module YouCanBookMe
20
20
  @connection = HttpCommand.new @account_id, @password_or_token
21
21
  end
22
22
 
23
- #
24
- # Account
25
- #
26
-
27
- def account_path
28
- "/#{API_VERSION}/#{@account_id}"
29
- end
30
-
31
23
  #
32
24
  # Get basic information about current account.
33
25
  #
34
26
  # @param [Array<String>] fields the fields which are included in the response.
35
27
  # @return [Account]
28
+ # @since 0.0.1
36
29
  def account(fields = nil)
37
- params = set_fields_into_params(fields)
30
+ params = set_fields_into_params fields
38
31
  res = @connection.get account_path, params
39
32
  Account.new res.body, self
40
33
  end
41
34
 
35
+ #
36
+ # Returns a single Profile by its id.
37
+ #
38
+ # @param [String] profile_id the profile's unique id.
39
+ # @param [Array<String>] fields the fields which are included in the response.
40
+ # @return [Profile]
41
+ # @since 0.0.2
42
+ def profile(profile_id, fields = nil)
43
+ check_not_empty profile_id, 'profile_id'
44
+ params = set_fields_into_params fields
45
+ res = @connection.get profile_path(profile_id), params
46
+ Profile.new res.body, self
47
+ end
48
+
49
+ #
50
+ # Get List of Profile.
51
+ #
52
+ # @param [Array<String>] fields the fields which are included in the response.
53
+ # @return [Array<Profile>]
54
+ # @since 0.0.2
55
+ def profiles(fields = nil)
56
+ params = set_fields_into_params fields
57
+ res = @connection.get profile_path, params
58
+ items = res.body
59
+ unless items.is_a? Array
60
+ raise YouCanBookMe::Error, 'the response data is not Array.'
61
+ end
62
+
63
+ items.map { |item| Profile.new item, self }
64
+ end
65
+
42
66
  #
43
67
  # Get suggested subdomains
44
68
  #
45
69
  # @return [Array<String>]
70
+ # @since 0.0.1
46
71
  def suggested_subdomains
47
72
  res = @connection.get "/#{API_VERSION}/suggestedsubdomains"
48
73
  res.body
@@ -54,6 +79,7 @@ module YouCanBookMe
54
79
  # @param [String] subdomain
55
80
  # @return [Boolean]
56
81
  # @raise [YouCanBookMe::Error] if the subdomain arg is empty.
82
+ # @since 0.0.1
57
83
  def subdomain_available?(subdomain)
58
84
  check_not_empty subdomain, 'subdomain'
59
85
  res = @connection.get "/#{API_VERSION}/subdomains/#{subdomain}"
@@ -81,5 +107,16 @@ module YouCanBookMe
81
107
 
82
108
  params.merge(fields: fields.join(','))
83
109
  end
110
+
111
+ def account_path
112
+ "/#{API_VERSION}/#{@account_id}"
113
+ end
114
+
115
+ def profile_path(profile_id = nil)
116
+ path = "#{account_path}/profiles"
117
+ return path unless profile_id
118
+
119
+ "#{path}/#{profile_id}"
120
+ end
84
121
  end
85
122
  end
@@ -19,6 +19,7 @@ module YouCanBookMe
19
19
  #
20
20
  # @param [String] path String or URI to access.
21
21
  # @param [Hash] params Hash of URI query unencoded key/value pairs.
22
+ # @since 0.0.1
22
23
  def get(path, params = {})
23
24
  debug_log "GET #{connection.build_url("#{@host}#{path}", params)}"
24
25
  res = connection.get path, params
@@ -32,6 +33,7 @@ module YouCanBookMe
32
33
  # @param [String] path String or URI to access.
33
34
  # @param [Hash] body_params
34
35
  # The request body that will eventually be converted to JSON.
36
+ # @since 0.0.1
35
37
  def post(path, body_params = {})
36
38
  debug_log "POST #{@host}#{path} body:#{body_params}"
37
39
  headers = { 'Content-Type' => 'application/json' }
@@ -46,6 +48,7 @@ module YouCanBookMe
46
48
  # @param [String] path String or URI to access.
47
49
  # @param [Hash] body_params
48
50
  # The request body that will eventually be converted to JSON.
51
+ # @since 0.0.1
49
52
  def put(path, body_params = {})
50
53
  debug_log "PUT #{@host}#{path} body:#{body_params}"
51
54
  headers = { 'Content-Type' => 'application/json' }
@@ -60,6 +63,7 @@ module YouCanBookMe
60
63
  # @param [String] path String or URI to access.
61
64
  # @param [Hash] body_params
62
65
  # The request body that will eventually be converted to JSON.
66
+ # @since 0.0.1
63
67
  def patch(path, body_params = {})
64
68
  debug_log "PATCH #{@host}#{path} body:#{body_params}"
65
69
  headers = { 'Content-Type' => 'application/json' }
@@ -73,6 +77,7 @@ module YouCanBookMe
73
77
  #
74
78
  # @param [String] path String or URI to access.
75
79
  # @param [Hash] params Hash of URI query unencoded key/value pairs.
80
+ # @since 0.0.1
76
81
  def delete(path, params = {})
77
82
  debug_log "DELETE #{@host}#{path} params:#{params}"
78
83
  res = connection.delete path, params
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module YouCanBookMe
4
- VERSION = '0.0.1.alpha'
4
+ VERSION = '0.0.2.alpha'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: youcanbookme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.alpha
4
+ version: 0.0.2.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenji Koshikawa
@@ -221,7 +221,7 @@ metadata:
221
221
  homepage_uri: https://github.com/koshilife/youcanbookme-api-ruby-client
222
222
  source_code_uri: https://github.com/koshilife/youcanbookme-api-ruby-client
223
223
  changelog_uri: https://github.com/koshilife/youcanbookme-api-ruby-client/blob/master/CHANGELOG.md
224
- documentation_uri: https://www.rubydoc.info/gems/youcanbookme/0.0.1.alpha
224
+ documentation_uri: https://www.rubydoc.info/gems/youcanbookme/0.0.2.alpha
225
225
  post_install_message:
226
226
  rdoc_options: []
227
227
  require_paths: