Class: Fred::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/fred/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



10
11
12
# File 'lib/fred/client.rb', line 10

def initialize(options={})
  @api_key = options[:api_key] || Fred.api_key
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



8
9
10
# File 'lib/fred/client.rb', line 8

def api_key
  @api_key
end

Instance Method Details

#category(secondary, options = {}) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/fred/client.rb', line 14

def category(secondary, options={})
  if secondary.nil?
    mashup(self.class.get("/category", :query => options.merge(self.default_options)))
  else
    mashup(self.class.get("/category/#{secondary}", :query => options.merge(self.default_options)))			
  end
end

#release(secondary, options = {}) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/fred/client.rb', line 30

def release(secondary, options={})
  if secondary.nil?
    mashup(self.class.get("/release", :query => options.merge(self.default_options)))
  else
    mashup(self.class.get("/release/#{secondary}", :query => options.merge(self.default_options)))			
  end
end

#releases(secondary, options = {}) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/fred/client.rb', line 22

def releases(secondary, options={})
  if secondary.nil?
    mashup(self.class.get("/releases", :query => options.merge(self.default_options)))
  else
    mashup(self.class.get("/releases/#{secondary}", :query => options.merge(self.default_options)))			
  end
end

#series(secondary, options = {}) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/fred/client.rb', line 38

def series(secondary, options={})
  if secondary.nil?
    mashup(self.class.get("/series", :query => options.merge(self.default_options)))
  else
    mashup(self.class.get("/series/#{secondary}", :query => options.merge(self.default_options)))			
  end
end

#source(secondary, options = {}) ⇒ Object



54
55
56
57
58
59
60
# File 'lib/fred/client.rb', line 54

def source(secondary, options={})
  if secondary.nil?
    mashup(self.class.get("/source", :query => options.merge(self.default_options)))
  else
    mashup(self.class.get("/source/#{secondary}", :query => options.merge(self.default_options)))			
  end
end

#sources(secondary, options = {}) ⇒ Object



46
47
48
49
50
51
52
# File 'lib/fred/client.rb', line 46

def sources(secondary, options={})
  if secondary.nil?
    mashup(self.class.get("/sources?", :query => options.merge(self.default_options)))
  else
    mashup(self.class.get("/sources/#{secondary}", :query => options.merge(self.default_options)))			
  end
end