redd 0.7.10 → 0.8.0.pre.1

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.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -30
  3. data/.rspec +1 -1
  4. data/.rubocop.yml +16 -3
  5. data/.travis.yml +13 -7
  6. data/Gemfile +3 -1
  7. data/LICENSE.txt +21 -0
  8. data/README.md +40 -126
  9. data/Rakefile +10 -3
  10. data/TODO.md +11 -0
  11. data/bin/console +84 -0
  12. data/bin/setup +8 -0
  13. data/lib/redd.rb +84 -46
  14. data/lib/redd/api_client.rb +109 -0
  15. data/lib/redd/auth_strategies/auth_strategy.rb +60 -0
  16. data/lib/redd/auth_strategies/installed.rb +22 -0
  17. data/lib/redd/auth_strategies/script.rb +23 -0
  18. data/lib/redd/auth_strategies/userless.rb +17 -0
  19. data/lib/redd/auth_strategies/web.rb +29 -0
  20. data/lib/redd/client.rb +88 -0
  21. data/lib/redd/error.rb +19 -142
  22. data/lib/redd/models/access.rb +20 -0
  23. data/lib/redd/models/basic_model.rb +124 -0
  24. data/lib/redd/models/comment.rb +51 -0
  25. data/lib/redd/models/front_page.rb +71 -0
  26. data/lib/redd/models/inboxable.rb +23 -0
  27. data/lib/redd/models/lazy_model.rb +63 -0
  28. data/lib/redd/models/listing.rb +26 -0
  29. data/lib/redd/models/messageable.rb +20 -0
  30. data/lib/redd/models/moderatable.rb +41 -0
  31. data/lib/redd/models/more_comments.rb +10 -0
  32. data/lib/redd/models/multireddit.rb +32 -0
  33. data/lib/redd/models/postable.rb +70 -0
  34. data/lib/redd/models/private_message.rb +29 -0
  35. data/lib/redd/models/replyable.rb +16 -0
  36. data/lib/redd/models/session.rb +86 -0
  37. data/lib/redd/models/submission.rb +40 -0
  38. data/lib/redd/models/subreddit.rb +201 -0
  39. data/lib/redd/models/user.rb +72 -0
  40. data/lib/redd/models/wiki_page.rb +24 -0
  41. data/lib/redd/utilities/error_handler.rb +35 -0
  42. data/lib/redd/utilities/rate_limiter.rb +21 -0
  43. data/lib/redd/utilities/stream.rb +63 -0
  44. data/lib/redd/utilities/unmarshaller.rb +39 -0
  45. data/lib/redd/version.rb +4 -3
  46. data/logo.png +0 -0
  47. data/redd.gemspec +26 -22
  48. metadata +73 -99
  49. data/LICENSE.md +0 -22
  50. data/RedditKit.LICENSE.md +0 -9
  51. data/lib/redd/access.rb +0 -76
  52. data/lib/redd/clients/base.rb +0 -188
  53. data/lib/redd/clients/base/account.rb +0 -20
  54. data/lib/redd/clients/base/identity.rb +0 -22
  55. data/lib/redd/clients/base/none.rb +0 -27
  56. data/lib/redd/clients/base/privatemessages.rb +0 -33
  57. data/lib/redd/clients/base/read.rb +0 -113
  58. data/lib/redd/clients/base/stream.rb +0 -81
  59. data/lib/redd/clients/base/submit.rb +0 -19
  60. data/lib/redd/clients/base/utilities.rb +0 -104
  61. data/lib/redd/clients/base/wikiread.rb +0 -33
  62. data/lib/redd/clients/installed.rb +0 -57
  63. data/lib/redd/clients/script.rb +0 -41
  64. data/lib/redd/clients/userless.rb +0 -32
  65. data/lib/redd/clients/web.rb +0 -58
  66. data/lib/redd/objects/base.rb +0 -39
  67. data/lib/redd/objects/comment.rb +0 -22
  68. data/lib/redd/objects/labeled_multi.rb +0 -13
  69. data/lib/redd/objects/listing.rb +0 -29
  70. data/lib/redd/objects/more_comments.rb +0 -11
  71. data/lib/redd/objects/private_message.rb +0 -28
  72. data/lib/redd/objects/submission.rb +0 -139
  73. data/lib/redd/objects/subreddit.rb +0 -330
  74. data/lib/redd/objects/thing.rb +0 -26
  75. data/lib/redd/objects/thing/editable.rb +0 -22
  76. data/lib/redd/objects/thing/hideable.rb +0 -18
  77. data/lib/redd/objects/thing/inboxable.rb +0 -25
  78. data/lib/redd/objects/thing/messageable.rb +0 -34
  79. data/lib/redd/objects/thing/moderatable.rb +0 -43
  80. data/lib/redd/objects/thing/refreshable.rb +0 -14
  81. data/lib/redd/objects/thing/saveable.rb +0 -21
  82. data/lib/redd/objects/thing/votable.rb +0 -33
  83. data/lib/redd/objects/user.rb +0 -52
  84. data/lib/redd/objects/wiki_page.rb +0 -15
  85. data/lib/redd/rate_limit.rb +0 -88
  86. data/lib/redd/response/parse_json.rb +0 -18
  87. data/lib/redd/response/raise_error.rb +0 -16
  88. data/spec/redd/objects/base_spec.rb +0 -1
  89. data/spec/redd/response/raise_error_spec.rb +0 -11
  90. data/spec/redd_spec.rb +0 -5
  91. data/spec/spec_helper.rb +0 -71
@@ -1,11 +0,0 @@
1
- RSpec.describe Redd::Response::RaiseError do
2
- it "return nil if there's no error" do
3
- error = subject.on_complete(
4
- status: 200,
5
- body: {success: true},
6
- response_headers: {}
7
- )
8
-
9
- expect(error).to be(nil)
10
- end
11
- end
@@ -1,5 +0,0 @@
1
- RSpec.describe Redd do
2
- it "has a version number" do
3
- expect(Redd::VERSION).to be_a(String)
4
- end
5
- end
@@ -1,71 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
2
- require "vcr"
3
- require "redd"
4
-
5
- VCR.configure do |config|
6
- config.cassette_library_dir = "spec/cassettes"
7
- config.hook_into :webmock
8
- config.default_cassette_options = {record: :new_episodes}
9
- config.configure_rspec_metadata!
10
- end
11
-
12
- RSpec.configure do |config|
13
- # rspec-expectations config goes here. You can use an alternate
14
- # assertion/expectation library such as wrong or the stdlib/minitest
15
- # assertions if you prefer.
16
- config.expect_with :rspec do |expectations|
17
- # This option will default to `true` in RSpec 4. It makes the `description`
18
- # and `failure_message` of custom matchers include text for helper methods
19
- # defined using `chain`, e.g.:
20
- # be_bigger_than(2).and_smaller_than(4).description
21
- # # => "be bigger than 2 and smaller than 4"
22
- # ...rather than:
23
- # # => "be bigger than 2"
24
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
25
- end
26
-
27
- # rspec-mocks config goes here. You can use an alternate test double
28
- # library (such as bogus or mocha) by changing the `mock_with` option here.
29
- config.mock_with :rspec do |mocks|
30
- # Prevents you from mocking or stubbing a method that does not exist on
31
- # a real object. This is generally recommended, and will default to
32
- # `true` in RSpec 4.
33
- mocks.verify_partial_doubles = true
34
- end
35
-
36
- # These two settings work together to allow you to limit a spec run
37
- # to individual examples or groups you care about by tagging them with
38
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
39
- # get run.
40
- config.filter_run_including :focus
41
- config.run_all_when_everything_filtered = true
42
-
43
- # If we don't have the details to perform authentication, we can't do those
44
- # tests.
45
- if ENV["TRAVIS_SECURE_ENV_VARS"] == "false"
46
- config.filter_run_excluding :secure
47
- end
48
-
49
- # Limits the available syntax to the non-monkey patched syntax that is
50
- # recommended. For more details, see:
51
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
52
- # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
53
- # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
54
- config.disable_monkey_patching!
55
-
56
- # This setting enables warnings. It's recommended, but in some cases may
57
- # be too noisy due to issues in dependencies.
58
- config.warnings = true
59
-
60
- # Run specs in random order to surface order dependencies. If you find an
61
- # order dependency and want to debug it, you can fix the order by providing
62
- # the seed, which is printed after each run.
63
- # --seed 1234
64
- config.order = :random
65
-
66
- # Seed global randomization in this process using the `--seed` CLI option.
67
- # Setting this allows you to use `--seed` to deterministically reproduce
68
- # test failures related to randomization by passing the same `--seed` value
69
- # as the one that triggered the failure.
70
- Kernel.srand config.seed
71
- end