rolling_paper 0.0.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fc18d1a7550bc578f13cd9b564c81bebc7647be3
4
+ data.tar.gz: 46507f80afe697f5d3efdbc8de9d57141a8181bb
5
+ SHA512:
6
+ metadata.gz: 2d58896389dd3581ee07b4ef7161421c35d92c0daf0c150edade1f44dcae47dd408c75d8352d8f91edff72c7625801cb249db03dc3491c2a111a199b3644d4ac
7
+ data.tar.gz: 1b7cb5a3fc5f99662ce921633b6f03fb3b49a6c1fbfa08826292e08a2fccfa88887f09b58418f679b41fce644ea4a552cc843a9cdc4f073dd60d726c3d2805d8
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rolling_paper.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 TODO: Write your name
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,29 @@
1
+ # RollingPaper
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'rolling_paper'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install rolling_paper
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,52 @@
1
+ require 'faraday'
2
+ require 'json'
3
+
4
+ class Strain
5
+
6
+ def self.all_strains
7
+ response = Faraday.get("http://www.leafly.com/api/strains")
8
+ strains_json = JSON.parse(response.body)
9
+ strains_json.collect {|strain| new (strain)}
10
+ end
11
+
12
+ def self.all_key_names
13
+ response = Faraday.get("http://www.leafly.com/api/strains")
14
+ strains_json = JSON.parse(response.body)
15
+ strains_json.collect do |strain|
16
+ strain["Key"]
17
+ end
18
+ end
19
+
20
+ def self.find_by_key(key)
21
+ response = Faraday.get("http://www.leafly.com/api/details/#{key}")
22
+ strain_json = JSON.parse(response.body)
23
+ new (strain_json)
24
+ end
25
+
26
+ def self.find_by_category(category)
27
+ response = Faraday.get("http://www.leafly.com/api/strains?category=#{category}")
28
+ strains_json = JSON.parse(response.body)
29
+ strains_json.collect {|strain| new (strain)}
30
+ end
31
+
32
+ attr_reader :key, :effects, :id, :name, :category,
33
+ :description, :symbol, :overview, :url,
34
+ :rating, :medical_uses, :side_effects, :reviews
35
+
36
+ def initialize(data)
37
+ @key = data["Key"]
38
+ @id = data["Id"]
39
+ @name = data["Name"]
40
+ @category = data["Category"]
41
+ @description = data["Abstract"]
42
+ @symbol = data["Symbol"]
43
+ @overview = data["Overview"]
44
+ @url = data["Url"]
45
+ @rating = data["Rating"]
46
+ @effects = data["Effects"] #returns an array of hashes for each effect
47
+ @medical_uses = data["Medical"]
48
+ @side_effects = data["Negative"]
49
+ @reviews = data["Reviews"]
50
+ end
51
+
52
+ end
@@ -0,0 +1,3 @@
1
+ module RollingPaper
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,6 @@
1
+ require "rolling_paper/version"
2
+ require 'rolling_paper/strain'
3
+
4
+ module RollingPaper
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rolling_paper/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rolling_paper"
8
+ spec.version = RollingPaper::VERSION
9
+ spec.authors = ["BryanaKnight", "fluxusfrequency", "benhorne44", "dpequeen"]
10
+ spec.email = ["brknig11@gmail.com", "benmlewis@gmail.com", "benhorne44@gmail.com", "pequickster@gmail.com"]
11
+ spec.description = "Consume leafly API"
12
+ spec.summary = "Gather strain information"
13
+ spec.homepage = "https://github.com/BryanaKnight/rolling_paper"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
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.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_runtime_dependency "faraday"
24
+ spec.add_runtime_dependency "json"
25
+ spec.add_development_dependency "rspec"
26
+
27
+
28
+ end
@@ -0,0 +1,70 @@
1
+ require 'spec_helper'
2
+
3
+ describe Strain do
4
+
5
+ describe ".all_strains" do
6
+
7
+ before :all do
8
+ @strains = Strain.all_strains
9
+ end
10
+
11
+ it "should return all the strains" do
12
+ expect(@strains.length).to be > 10
13
+ end
14
+
15
+ it "should include attributes" do
16
+ expect(@strains.first.id).to_not be(nil)
17
+ end
18
+
19
+ it "should return strain objects" do
20
+ expect(@strains.first.kind_of?(Strain)).to be true
21
+ end
22
+ end
23
+
24
+ describe ".all_key_names" do
25
+
26
+ before :all do
27
+ @strain_names = Strain.all_key_names
28
+ end
29
+
30
+ it "should return all the key names" do
31
+ expect(@strain_names.length).to be > 10
32
+ end
33
+
34
+ it "should return names of strains" do
35
+ expect(@strain_names.include?("ak-47")).to be true
36
+ end
37
+
38
+ end
39
+
40
+ describe ".find_by_key(key)" do
41
+
42
+ before :all do
43
+ @strain = Strain.find_by_key("ak-47")
44
+ end
45
+
46
+ it "should return the correct strain" do
47
+ expect(@strain.key).to eq("ak-47")
48
+ end
49
+
50
+ it "should return a strain object" do
51
+ expect(@strain.kind_of?(Strain)).to be true
52
+ end
53
+ end
54
+
55
+ describe ".find_by_category(category)" do
56
+
57
+ before :all do
58
+ @strains = Strain.find_by_category("Hybrid")
59
+ end
60
+
61
+ it "should return the correct strain" do
62
+ expect(@strains.all? {|strain| strain.category == "Hybrid"} ).to be true
63
+ end
64
+
65
+ it "should return a strain object" do
66
+ expect(@strains.first.kind_of?(Strain)).to be true
67
+ end
68
+ end
69
+
70
+ end
@@ -0,0 +1,6 @@
1
+ require 'rspec'
2
+ require 'rolling_paper'
3
+
4
+ RSpec.configure do |config|
5
+ config.color_enabled = true
6
+ end
metadata ADDED
@@ -0,0 +1,133 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rolling_paper
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - BryanaKnight
8
+ - fluxusfrequency
9
+ - benhorne44
10
+ - dpequeen
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2014-01-07 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: bundler
18
+ requirement: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: '1.3'
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - '>='
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ - !ruby/object:Gem::Dependency
45
+ name: faraday
46
+ requirement: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ - !ruby/object:Gem::Dependency
59
+ name: json
60
+ requirement: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ type: :runtime
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ - !ruby/object:Gem::Dependency
73
+ name: rspec
74
+ requirement: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ type: :development
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ description: Consume leafly API
87
+ email:
88
+ - brknig11@gmail.com
89
+ - benmlewis@gmail.com
90
+ - benhorne44@gmail.com
91
+ - pequickster@gmail.com
92
+ executables: []
93
+ extensions: []
94
+ extra_rdoc_files: []
95
+ files:
96
+ - .gitignore
97
+ - Gemfile
98
+ - LICENSE.txt
99
+ - README.md
100
+ - Rakefile
101
+ - lib/rolling_paper.rb
102
+ - lib/rolling_paper/strain.rb
103
+ - lib/rolling_paper/version.rb
104
+ - rolling_paper.gemspec
105
+ - spec/rolling_paper_spec.rb
106
+ - spec/spec_helper.rb
107
+ homepage: https://github.com/BryanaKnight/rolling_paper
108
+ licenses:
109
+ - MIT
110
+ metadata: {}
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 2.0.6
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: Gather strain information
131
+ test_files:
132
+ - spec/rolling_paper_spec.rb
133
+ - spec/spec_helper.rb