calculated 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -31,13 +31,13 @@ You can install it as:
31
31
  @session = Calculated::Session.create(:api_key => "your_api_key")
32
32
 
33
33
  ##Overwriting defaults##
34
-
34
+ ``
35
35
  **These are the defaults**
36
36
 
37
37
  caching # => true (boolean)
38
38
  expires_in # => 60*60*24 (seconds)
39
39
  cache # => Moneta::Memory.new "(Moneta Supported Cache) http://github.com/wycats/moneta
40
- server # => "api.carboncalculated.com" (string)
40
+ server # => "api-stage.carboncalculated.com" (string)
41
41
  api_version #=> "v1" (string)
42
42
  logging # => true (boolean)
43
43
 
@@ -64,7 +64,7 @@ Now that you have a session you can call methods on the session to interact with
64
64
 
65
65
  Lets first got to the calculator on the browser (click here to see what I mean http://browser.carboncalculated.com/calculators/4bab7e4ff78b122cdd000004/computations/4bab7e64f78b122cdd000005"
66
66
 
67
- @answer = @session.answer_from_computation("4bab7e64f78b122cdd000005", {"material_category"=>"4bf42d8046a95925b5000efb", "type_of_material"=>"4bf42d8046a95925b5000f40", "material"=>"4bf42d8046a95925b5000f2a", "amount_of_material"=>"10", "formula_input_name"=>"emissions_by_kg"})
67
+ @answer = @session.answer_for_computation("4bab7e64f78b122cdd000005", {"material_category"=>"4bf42d8046a95925b5000efb", "type_of_material"=>"4bf42d8046a95925b5000f40", "material"=>"4bf42d8046a95925b5000f2a", "amount_of_material"=>"10", "formula_input_name"=>"emissions_by_kg"})
68
68
  @answer.calculations["co2"]["value"]
69
69
 
70
70
 
@@ -72,7 +72,7 @@ Lets first got to the calculator on the browser (click here to see what I mean h
72
72
  OR
73
73
 
74
74
 
75
- @answer = @session.answer_from_calculator("4bab7e4ff78b122cdd000004", {"material_category"=>"4bf42d8046a95925b5000efb", "type_of_material"=>"4bf42d8046a95925b5000f40", "material"=>"4bf42d8046a95925b5000f2a", "amount_of_material"=>"10", "formula_input_name"=>"emissions_by_kg"})
75
+ @answer = @session.answer_for_calculator("4bab7e4ff78b122cdd000004", {"material_category"=>"4bf42d8046a95925b5000efb", "type_of_material"=>"4bf42d8046a95925b5000f40", "material"=>"4bf42d8046a95925b5000f2a", "amount_of_material"=>"10", "formula_input_name"=>"emissions_by_kg"})
76
76
  @answer.calculations["co2"]["value"]
77
77
 
78
78
  This will return a Calculated::Models::Answer Object
@@ -3,7 +3,7 @@ require "httparty"
3
3
  require "hashie"
4
4
  require "moneta"
5
5
  require "moneta/memory"
6
-
6
+ require 'active_support/ordered_hash'
7
7
 
8
8
  require "calculated/generic_object_api_calls"
9
9
  require "calculated/object_template_api_calls"
@@ -2,12 +2,11 @@ module Calculated
2
2
  class Service
3
3
  include HTTParty
4
4
  format :json
5
- headers 'Accept' => 'application/json'
6
-
5
+
7
6
  # set the httparty defaults [this obviously makes 1 service] limitation me feels
8
7
  def initialize(server, api_version, api_key)
9
8
  self.class.base_uri "http://#{server}/api/#{api_version}"
10
- self.class.default_params :api_key => api_key
9
+ self.class.headers 'Accept' => 'application/json', "X-CCApiKey" => api_key
11
10
  end
12
11
 
13
12
  def get(path, params = {})
@@ -45,7 +45,7 @@ module Calculated
45
45
  @expires_in = options.delete(:expires_in) || 60*60*24
46
46
  @cache = options.delete(:cache) || Moneta::Memory.new
47
47
  end
48
- @server = options.delete(:server) || "api.carboncalculated.com"
48
+ @server = options.delete(:server) || "api-stage.carboncalculated.com"
49
49
  @api_version = options.delete(:api_version) || "v1"
50
50
  @logging = options[:logging].nil? ? true : options.delete(:caching)
51
51
  end
@@ -1,3 +1,3 @@
1
1
  module Calculated
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 5
9
- version: 0.1.5
8
+ - 6
9
+ version: 0.1.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Richard Hooker
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-15 00:00:00 +01:00
17
+ date: 2011-02-04 00:00:00 +00:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -33,8 +33,22 @@ dependencies:
33
33
  prerelease: false
34
34
  version_requirements: *id001
35
35
  - !ruby/object:Gem::Dependency
36
- name: httparty
36
+ name: i18n
37
37
  requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 0
44
+ - 5
45
+ version: "0.5"
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: httparty
51
+ requirement: &id003 !ruby/object:Gem::Requirement
38
52
  none: false
39
53
  requirements:
40
54
  - - ~>
@@ -46,10 +60,10 @@ dependencies:
46
60
  version: 0.6.1
47
61
  type: :runtime
48
62
  prerelease: false
49
- version_requirements: *id002
63
+ version_requirements: *id003
50
64
  - !ruby/object:Gem::Dependency
51
65
  name: hashie
52
- requirement: &id003 !ruby/object:Gem::Requirement
66
+ requirement: &id004 !ruby/object:Gem::Requirement
53
67
  none: false
54
68
  requirements:
55
69
  - - ~>
@@ -61,10 +75,10 @@ dependencies:
61
75
  version: 0.2.1
62
76
  type: :runtime
63
77
  prerelease: false
64
- version_requirements: *id003
78
+ version_requirements: *id004
65
79
  - !ruby/object:Gem::Dependency
66
80
  name: moneta
67
- requirement: &id004 !ruby/object:Gem::Requirement
81
+ requirement: &id005 !ruby/object:Gem::Requirement
68
82
  none: false
69
83
  requirements:
70
84
  - - ~>
@@ -76,10 +90,10 @@ dependencies:
76
90
  version: 0.6.0
77
91
  type: :runtime
78
92
  prerelease: false
79
- version_requirements: *id004
93
+ version_requirements: *id005
80
94
  - !ruby/object:Gem::Dependency
81
95
  name: tzinfo
82
- requirement: &id005 !ruby/object:Gem::Requirement
96
+ requirement: &id006 !ruby/object:Gem::Requirement
83
97
  none: false
84
98
  requirements:
85
99
  - - ~>
@@ -91,7 +105,7 @@ dependencies:
91
105
  version: 0.3.22
92
106
  type: :runtime
93
107
  prerelease: false
94
- version_requirements: *id005
108
+ version_requirements: *id006
95
109
  description: makes using a simple api even more simple;
96
110
  email:
97
111
  - richard.hooker@carboncalculated.com
@@ -136,7 +150,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
136
150
  requirements:
137
151
  - - ">="
138
152
  - !ruby/object:Gem::Version
139
- hash: -313905014687893020
153
+ hash: -3654974625844129550
140
154
  segments:
141
155
  - 0
142
156
  version: "0"