ribose 0.3.1 → 0.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7c4b6c53a6c8d7f9a5648e1aa4cb0bf8e37ffa9cac3d9d1fecd5c6fbbc1c81a
4
- data.tar.gz: 3a8eaac73e14e834ce155b3e2ca1c4ac1593d0925ad26dc61085c0a570f0883e
3
+ metadata.gz: c12513b80d2e78ad9faf2e3c64de85c0943ac3ba3b9ea7e048820e3fd35564eb
4
+ data.tar.gz: 373f583f12f65efb0ab2f76f6123d9f140c52e25fffd557718f0165b8bbff1f2
5
5
  SHA512:
6
- metadata.gz: 1fe42b371ab20c599bc152089f439aebd1ad02c5e04dccdef71b64e5b353b3c88984dfe2d4b088ebe5d75e27d54d6ebc433dae3ebadfc5531abe9167a21c79c4
7
- data.tar.gz: a6dd3241989f1499e3ee48710f8118eeafc886f4716cf3e59ef75a128eec2ae057073d7a5f39f23749744da25aa334b927afbdcabfd1991c50572a557f7b872f
6
+ metadata.gz: 734153a69502c7a0ffde70a561d9ba7842c5654c5f0cfde03267799a3a9dd2d0c0311382cab689135c87cfb28ca0349a6d4642abca7bac1786906e007af6b5f9
7
+ data.tar.gz: 578bab38e786870468f9a22c71785e819d06ee46e94fe050ea65e0aed1083abd96558bea5189939b9d64ffde608c5b19aa7303f7b697c17eb070b340d76069b6
data/.rubocop.yml CHANGED
@@ -1,9 +1,4 @@
1
1
  AllCops:
2
- Include:
3
- - "**/*.rake"
4
- - "**/Gemfile"
5
- - "**/Rakefile"
6
-
7
2
  Exclude:
8
3
  - db/schema.rb
9
4
 
@@ -357,8 +352,18 @@ Style/TrailingCommaInArguments:
357
352
  - no_comma
358
353
  Enabled: true
359
354
 
360
- Style/TrailingCommaInLiteral:
361
- Description: 'Checks for trailing comma in array and hash literals.'
355
+ Style/TrailingCommaInArrayLiteral:
356
+ Description: 'Checks for trailing comma in array literals.'
357
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
358
+ EnforcedStyleForMultiline: comma
359
+ SupportedStylesForMultiline:
360
+ - comma
361
+ - consistent_comma
362
+ - no_comma
363
+ Enabled: true
364
+
365
+ Style/TrailingCommaInHashLiteral:
366
+ Description: 'Checks for trailing comma in hash literals.'
362
367
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
363
368
  EnforcedStyleForMultiline: comma
364
369
  SupportedStylesForMultiline:
@@ -403,6 +408,13 @@ Layout/AlignParameters:
403
408
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-double-indent'
404
409
  Enabled: false
405
410
 
411
+ Layout/ConditionPosition:
412
+ Description: >-
413
+ Checks for condition placed in a confusing position relative to
414
+ the keyword.
415
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
416
+ Enabled: false
417
+
406
418
  Layout/DotPosition:
407
419
  Description: 'Checks the position of the dot in multi-line method calls.'
408
420
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
@@ -455,13 +467,6 @@ Lint/CircularArgumentReference:
455
467
  Description: "Don't refer to the keyword argument in the default value."
456
468
  Enabled: false
457
469
 
458
- Lint/ConditionPosition:
459
- Description: >-
460
- Checks for condition placed in a confusing position relative to
461
- the keyword.
462
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
463
- Enabled: false
464
-
465
470
  Lint/DeprecatedClassMethods:
466
471
  Description: 'Check for deprecated class method calls.'
467
472
  Enabled: false
@@ -487,7 +492,7 @@ Lint/HandleExceptions:
487
492
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
488
493
  Enabled: false
489
494
 
490
- Lint/LiteralInCondition:
495
+ Lint/LiteralAsCondition:
491
496
  Description: 'Checks of literals used in conditions.'
492
497
  Enabled: false
493
498
 
@@ -528,7 +533,7 @@ Lint/UnderscorePrefixedVariableName:
528
533
  Description: 'Do not use prefix `_` for a variable that is used.'
529
534
  Enabled: false
530
535
 
531
- Lint/UnneededDisable:
536
+ Lint/UnneededCopDisableDirective:
532
537
  Description: >-
533
538
  Checks for rubocop:disable comments that can be removed.
534
539
  Note: this cop is not disabled when disabling all cops.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 0.3.2 (2018-06-28)
2
+
3
+ Features:
4
+ - Add interface for calendar event resources
5
+ - Add interface for space category, file icon
6
+ - Add interface to fetch file version and etc.
7
+
8
+ Fixes:
9
+ - Fix file upload related error
10
+
1
11
  ## 0.2.0 (2017-11-30)
2
12
 
3
13
  Features:
@@ -1,4 +1,6 @@
1
+ require "json"
1
2
  require "faraday"
3
+ require "ostruct"
2
4
 
3
5
  module Ribose
4
6
  class FileUploader
@@ -49,7 +51,8 @@ module Ribose
49
51
 
50
52
  def notify_ribose_file_upload_endpoint(response, key)
51
53
  if response.status.to_i == 200
52
- Ribose::Request.post(space_file_path, file_attributes.merge(key: key))
54
+ content = Request.post(space_file_path, file_attributes.merge(key: key))
55
+ content.is_a?(Sawyer::Resource) ? content : parse_to_ribose_os(content)
53
56
  end
54
57
  end
55
58
 
@@ -70,6 +73,10 @@ module Ribose
70
73
  MIME::Types.type_for(file.path).first.content_type
71
74
  end
72
75
 
76
+ def parse_to_ribose_os(content)
77
+ JSON.parse(content, object_class: Ribose::OpenStruct)
78
+ end
79
+
73
80
  def file_attributes
74
81
  @file_attributes ||= {
75
82
  filesize: file.size,
@@ -90,4 +97,8 @@ module Ribose
90
97
  end
91
98
  end
92
99
  end
100
+
101
+ class OpenStruct < ::OpenStruct
102
+ alias :read_attribute_for_serialization :send
103
+ end
93
104
  end
@@ -1,3 +1,3 @@
1
1
  module Ribose
2
- VERSION = "0.3.1".freeze
2
+ VERSION = "0.3.2".freeze
3
3
  end
@@ -531,11 +531,11 @@ module Ribose
531
531
  end
532
532
  end
533
533
 
534
- def response_with(filename:, status:)
534
+ def response_with(filename:, status:, content_type: "application/json")
535
535
  {
536
536
  status: status,
537
537
  body: ribose_fixture(filename),
538
- headers: { content_type: "application/json" },
538
+ headers: { content_type: content_type },
539
539
  }
540
540
  end
541
541
 
@@ -546,11 +546,15 @@ module Ribose
546
546
  File.read(File.expand_path(file_path, __FILE__))
547
547
  end
548
548
 
549
- def stub_api_response(method, endpoint, filename:,
550
- status: 200, data: nil, client: nil)
549
+ def stub_api_response(method, endpoint, filename:, status: 200, data: nil,
550
+ client: nil, content_type: "application/json")
551
551
  stub_request(method, ribose_endpoint(endpoint)).
552
552
  with(ribose_headers(data: data, client: client)).
553
- to_return(response_with(filename: filename, status: status))
553
+ to_return(
554
+ response_with(
555
+ filename: filename, status: status, content_type: content_type,
556
+ ),
557
+ )
554
558
  end
555
559
  end
556
560
  end
@@ -28,6 +28,7 @@ module Ribose
28
28
  ribose_file_endpoint(space_id),
29
29
  data: build_notify_request_body(attributes),
30
30
  filename: "file_uploaded",
31
+ content_type: "text/html",
31
32
  )
32
33
  end
33
34
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ribose
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-20 00:00:00.000000000 Z
11
+ date: 2018-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: id_pack