theysaidso 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 04afc1892e0376c4accdb50606c7ea1e042f9f4f
4
+ data.tar.gz: a47ee0dda3850982414d0a09bdeaedcc2987beca
5
+ SHA512:
6
+ metadata.gz: 03fff41b213ecab0bb3b17a6cba6d90ba805baa45970176d0f98a33800378d009bfda3750fc53486de73fa6a2938e1dd388f2c3c57c30f82b3beb645ecd4c7f0
7
+ data.tar.gz: 75c2da4a0883a6a2afedbb5063e2be8ae859d20d2be941748b3df312be2c56887983eee02c2fd597cc9fa6e8778b633ea74a70ab44a0521698aa82518a43268e
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in theysaidso.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Hassanin Ahmed
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # They Said So
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'theysaidso'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install theysaidso
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/theysaidso/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,25 @@
1
+ require 'faraday'
2
+ require 'json'
3
+
4
+ API_URL = "http://api.theysaidso.com/qod.json"
5
+
6
+ class Theysaidso::QOD
7
+ attr_reader :id, :quote, :author, :length, :tags, :success, :category
8
+
9
+ def initialize(attrs)
10
+ @id = attrs['contents']['id']
11
+ @quote = attrs['contents']['quote']
12
+ @author = attrs['contents']['author']
13
+ @length = attrs['contents']['length']
14
+ @tags = attrs['contents']['tags']
15
+ @success = attrs['success']['total']
16
+ @category = attrs['category']
17
+ end
18
+
19
+ def self.fetch
20
+ response = Faraday.get(API_URL)
21
+ attrs = JSON.parse(response.body)
22
+ new(attrs)
23
+ end
24
+ end
25
+
@@ -0,0 +1,3 @@
1
+ module Theysaidso
2
+ VERSION = "0.1.0"
3
+ end
data/lib/theysaidso.rb ADDED
@@ -0,0 +1,6 @@
1
+ require "theysaidso/version"
2
+ require "theysaidso/qod"
3
+
4
+ module Theysaidso
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,55 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.theysaidso.com/qod.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.0
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - '*/*'
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Mon, 11 May 2015 03:48:01 GMT
23
+ Server:
24
+ - Apache
25
+ X-Auth-Status:
26
+ - 'false'
27
+ X-Ratelimit-Limit:
28
+ - 5 per hour
29
+ X-Ratelimit-Remaining:
30
+ - '3'
31
+ Access-Control-Allow-Origin:
32
+ - '*'
33
+ Access-Control-Allow-Methods:
34
+ - GET,POST,PUT,OPTIONS
35
+ Access-Control-Allow-Headers:
36
+ - x-access-token
37
+ Cache-Control:
38
+ - public, max-age=43200, pre-check=86400, post-check=43200
39
+ Expires:
40
+ - Mon, 11 May 2015 15:48:02 GMT
41
+ X-Powered-By:
42
+ - Luracast Restler v3.0.0rc3
43
+ Content-Language:
44
+ - en
45
+ Transfer-Encoding:
46
+ - chunked
47
+ Content-Type:
48
+ - application/json; charset=utf-8
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"success":{"total":1},"contents":{"id":"dz9FraZ1WKmxupoqKIA8lAeF","quote":"Winning
52
+ is a science, educate yourself to win .","author":"Sandeep Kakkar","length":"47","tags":["inspirational","inspire","winning"],"category":"inspire"}}'
53
+ http_version:
54
+ recorded_at: Mon, 11 May 2015 03:48:03 GMT
55
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,17 @@
1
+ require './test/test_helper'
2
+
3
+ class QODTest < Minitest::Test
4
+
5
+ def test_exists
6
+ assert Theysaidso::QOD
7
+ end
8
+
9
+ def test_it_gives_qod
10
+ VCR.use_cassette('qod') do
11
+ quote = Theysaidso::QOD.fetch
12
+ assert_equal Theysaidso::QOD, quote.class
13
+
14
+ assert_equal quote.success, 1
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,10 @@
1
+ require './lib/theysaidso'
2
+ require 'minitest/autorun'
3
+ require 'webmock/minitest'
4
+ require 'vcr'
5
+
6
+ VCR.configure do |c|
7
+ c.cassette_library_dir = "test/fixtures"
8
+ c.hook_into :webmock
9
+ end
10
+
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'theysaidso/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "theysaidso"
8
+ spec.version = Theysaidso::VERSION
9
+ spec.authors = ["Hassanin Ahmed"]
10
+ spec.email = ["sas1ni69@gmail.com"]
11
+ spec.summary = "A gem for the https://theysaidso.com API"
12
+ spec.description = "A gem for the https://theysaidso.com API"
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "minitest"
24
+ spec.add_development_dependency "vcr"
25
+ spec.add_development_dependency "webmock"
26
+
27
+ spec.add_dependency "faraday"
28
+ spec.add_dependency "json"
29
+ end
metadata ADDED
@@ -0,0 +1,157 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: theysaidso
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Hassanin Ahmed
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: vcr
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: faraday
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: json
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: A gem for the https://theysaidso.com API
112
+ email:
113
+ - sas1ni69@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - .gitignore
119
+ - Gemfile
120
+ - LICENSE.txt
121
+ - README.md
122
+ - Rakefile
123
+ - lib/theysaidso.rb
124
+ - lib/theysaidso/qod.rb
125
+ - lib/theysaidso/version.rb
126
+ - test/fixtures/qod.yml
127
+ - test/qod/qod_test.rb
128
+ - test/test_helper.rb
129
+ - theysaidso.gemspec
130
+ homepage: ''
131
+ licenses:
132
+ - MIT
133
+ metadata: {}
134
+ post_install_message:
135
+ rdoc_options: []
136
+ require_paths:
137
+ - lib
138
+ required_ruby_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - '>='
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ requirements: []
149
+ rubyforge_project:
150
+ rubygems_version: 2.4.5
151
+ signing_key:
152
+ specification_version: 4
153
+ summary: A gem for the https://theysaidso.com API
154
+ test_files:
155
+ - test/fixtures/qod.yml
156
+ - test/qod/qod_test.rb
157
+ - test/test_helper.rb